How does orphanRemoval work with JPA and Hibernate

Introduction In this article, we are going to see how the JPA and Hibernate orphanRemoval mechanism allows us to trigger an entity child remove operation upon disassociating the child entity reference from the child collection on the parent side.

How does CascadeType.LOCK works in JPA and Hibernate

Introduction Having introduced Hibernate explicit locking support, as well as Cascade Types, it’s time to analyze the CascadeType.LOCK behavior. A Hibernate lock request triggers an internal LockEvent. The associated DefaultLockEventListener may cascade the lock request to the locking entity children. Since CascadeType.ALL includes CascadeType.LOCK too, it’s worth understanding when a lock request propagates from a Parent to a Child entity.

A beginner’s guide to JPA and Hibernate Cascade Types

Introduction JPA translates entity state transitions to database DML statements. Because it’s common to operate on entity graphs, JPA allows us to propagate entity state changes from Parents to Child entities. This behavior is configured through the CascadeType mappings.