Hibernate 6 EmbeddableInstantiator – Instantiate embeddables your way
| |

Hibernate 6 EmbeddableInstantiator – Instantiate embeddables your way

Embeddables are simple Java objects. They provide an easy way to define and group a set of attributes that become part of your entity. Developers often use them to create reusable mapping information and handle them using the same piece of business code. Unfortunately, the JPA specification and Hibernate until version 6.0.0, required your embeddable…

FlushMode in JPA and Hibernate – What it is and how to change it

FlushMode in JPA and Hibernate – What it is and how to change it

The FlushMode defines when new entities and your changes on existing ones get written to the database. This might seem like a simple and obvious mechanism. But I recognized in my Q&A calls that it often causes some confusion because, by default, Hibernate doesn’t perform a flush when you call the persist method on your EntityManager, or the save method on your…

The Best Mapping for Shared Technical Attributes With Hibernate

The Best Mapping for Shared Technical Attributes With Hibernate

Most domain models have a few technical attributes shared by most entity classes. Typical examples are the version attribute and the timestamp or user who performed the last update or persisted an entity. In these situations, many developers ask themselves what’s the best way to model these attributes. Oleg did the same recently in the…

Mixing Inheritance Mapping Strategies with Hibernate

Mixing Inheritance Mapping Strategies with Hibernate

Inheritance is one of the key concepts in Java, and most development teams prefer using it in their domain model. Unfortunately, relational table models don’t support the concept of inheritance. The JPA specification defines multiple mapping strategies to bridge the gap between the object-oriented and the relational world. I explained them in great detail in…