How to increment the parent entity version whenever a child entity gets modified with JPA and Hibernate

Introduction StackOverflow and the Hibernate forum are gold mines. Yesterday, I bumped on the following question on our forum: Usually, the rationale behind clustering objects together is to form a transactional boundary inside which business invariants are protected. I’ve noticed that with the OPTIMISTIC locking mode changes to a child entity will not cause a version increment on the root. This behavior makes it quite useless to cluster objects together in the first place. Is there a way to configure Hibernate so that any changes to an object cluster will cause the… Read More

High-Performance Java Persistence – Part Three

100% done The third part of High-Performance Java Persistence book is out. It’s been one year and two months since I started writing this book, and nine months since I published the first part.

JPA providers market share in 2016

The survey Java Persistence API is a standard. Hence, there are multiple options to choose from: Hibernate EclipseLink OpenJPA Some applications choose not to use an ORM framework at all. For this reason, I decided to run a one-day survey on Twitter to get a glimpse on the JPA providers market share.

Fluent API entity building with JPA and Hibernate

Introduction The JHipster development team wants to expose Fluent Interface entity building methods for their JPA entities, so they asked me if this is going to work with JPA and Hibernate. While JPA is rather strict about entity getters and setter, Hibernate is more lenient in this regard.

The best way to map a Composite Primary Key with JPA and Hibernate

Introduction One of my readers asked me to help him map a Composite Primary Key using JPA and Hibernate. Because this is a recurrent question, I decided to write a blog post in which I describe this mapping is more detail.