How to implement an AttributeConverter to support custom types
| |

How to implement an AttributeConverter to support custom types

All JPA implementations, including Hibernate, provide default mappings for a huge set of standard Java classes. You could model the attributes of all your entity classes using those mappings, and you would be able to map all columns of your table model. But this is often not the best fit for your business logic. A…

Hibernate-specific extensions to the Criteria API
|

Hibernate-specific extensions to the Criteria API

Most developers know that the JPA specification defines the string-based JPQL query language and that Hibernate extends it to support things like database-specific functions, window functions, and set-based operations. But most developers don’t know that since version 6, Hibernate has done the same for JPA’s Criteria API. Extending an API is, of course, a little more complex…

Sequence naming strategies in Hibernate 6
|

Sequence naming strategies in Hibernate 6

Hibernate 6 introduced a new configuration parameter and an interface to define the implicit naming strategy for database sequences and tables used to generate primary key values. When you migrate an existing application to Hibernate 6, you quickly recognize that change because the default naming strategy has changed. Due to that, Hibernate might try using…