How to merge entity collections with JPA and Hibernate

Introduction In this article, you are going to learn why overwriting entity collections is an anti-pattern and how you can merge collections both effectively and efficiently with JPA and Hibernate. The reason I decided to write this article is that I’ve been this question asked over and over and over again.

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.

Black Friday 50% off the High-Performance Java, Spring, and SQL course bundle: 24 hours of video lessons Ends in Get the Bundle

Black Friday

Seize the deal! 50% off my video courses

This offer expires in:
Java Persistence Video Course Save 50% Buy Now SQL Video Course Save 50% Buy Now Spring Persistence Video Course Save 50% Buy Now

The BLACKFRIDAY26 coupon is applied automatically at checkout.