Logging Guide for Hibernate 4, 5 & 6 – Use the right config for dev and prod
|

Logging Guide for Hibernate 4, 5 & 6 – Use the right config for dev and prod

Choosing the right logging configuration can make the difference between finding a performance issue during development or suffering from it on production. But it can also create an overhead that slows down your application. You need to decide which information you need and configure your system accordingly. I, therefore, prefer to use two different configurations:…

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…