How to fix “wrong column type encountered” schema-validation errors with JPA and Hibernate
Introduction Mapping entities to database tables is usually a very straightforward process. However, if your mappings are rather unusual, you might bump into some rare issues like this one I found on the Hibernate forum. In this article, I’m going to explain the mapping between Java objects to JDBC and database column types, and how you can fix the issue described in the aforementioned Hibernate question.
How to map the latest child of a parent entity using Hibernate JoinFormula
Introduction In this article, I’m going to explain how the Hibernate JoinFormula annotation works and how you can use it to map the latest child of a parent entity. As previously explained, the @JoinFormula is a very awesome annotation which allows you to customize the way you join entities beyond JPA @JoinColumn capabilities.
How to map calculated properties with Hibernate @Generated annotation
Introduction As I explained in this previous article, you can map calculated properties using Hibernate @Formula, and the value is generated at query time. In this post, you’ll see how you can calculate an entity property at INSERT or UPDATE time.
The best way to map a Composite Key with JPA and Hibernate
Introduction One of my readers asked me to help him map a Composite Key using JPA and Hibernate. Because this is a recurrent question, I decided to write a blog post in which I describe this mapping in more detail.
The best way to map a @OneToOne relationship with JPA and Hibernate
Introduction In this article, we are going to learn the best way to map a OneToOne association with JPA and Hibernate. While there are many ways you can map a one-to-one relationship with Hibernate, I’m going to demonstrate which mapping is the most efficient one from a database perspective.
How to map JSON objects using generic Hibernate Types
Introduction In this article, we are going to see how you can map a JSON column to a JPA entity attribute using the Hypersistence Utils open-source project. While you can create your own custom Hibernate Types, for mapping JSON column types on Oracle, SQL Server, PostgreSQL, or MySQL, you don’t need to implement your own Hibernate Type since the Hypersistence Utils project already offers this functionality.

