How to generate UUIDs as primary keys with Hibernate
| |

How to generate UUIDs as primary keys with Hibernate

Most developers prefer numerical primary keys because they are efficient to use and easy to generate. But that doesn’t mean that a primary key has to be a number. UUIDs, for example, have gained some popularity over recent years. The main advantage of a UUID is its (practical) global uniqueness which provides a huge advantage…

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…

Hibernate Tip: How to customize the association mappings using a composite key

Hibernate Tip: How to customize the association mappings using a composite key

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please post a comment below. Question: “One of my entities uses an @IdentityClass to map a composite primary key, and I need to map a…

Hibernate Tip: Many-to-Many Association with additional Attributes

Hibernate Tip: Many-to-Many Association with additional Attributes

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please post a comment below. Question: I got several questions, like the following one by Carme, about the mapping of a many-to-many association that contains…