How to map encrypted database columns with Hibernate’s @ColumnTransformer annotation

How to map encrypted database columns with Hibernate’s @ColumnTransformer annotation

A few days ago, someone asked me how to map an encrypted database column to an entity attribute. I remembered that I used a @ColumnTransformer for a similar use case, a few years ago. A quick chat with the Hibernate team confirmed that they hadn’t done any major changes in that area and that the…

@NaturalId – A good way to persist natural IDs with Hibernate?

@NaturalId – A good way to persist natural IDs with Hibernate?

In the real world, most objects have a natural identifier. Typical examples are the ISBN number of a book, a company’s tax identifier or a person’s social security number. You could, of course, use these identifiers as primary keys. But most often, it’s a better idea to generate numeric, surrogate keys. They are easier to…