Introduction In this article, I’m going to explain how we can map Java Records to JSON columns when using Hibernate. Because Hibernate ORM does not offer built-in support for JSON, we are going to use the Hiberate Types library, which allows you to map entity attributes to JSON column types, no matter if you are using Oracle, SQL Server, PostgreSQL, or MySQL.
Introduction In this article, we are going to see how we can store Java Map entity attributes in JSON columns when using JPA, Hibernate, and the Hibernate Types project. While you can also persist Java Map entity attributes in PostgreSQL HStore columns, a JSON column type is a much more common option, especially since it works with other relational databases, like Oracle, SQL Server, or MySQL. As you already have seen, the Hibernate Types project allows you to map a JSON column type to a wide variety of JPA entity attributes, like… Read More
Introduction In this article, I’m going to show you how to map PostgreSQL ARRAY column types (e.g., text, int, double, enum, date, timestamp, UUID) to Java List entity attributes with JPA and Hibernate. While the Hibernate Types project has been supporting PostgreSQL ARRAY column types since the very first version, prior to version 2.9, you could only map database ARRAY columns to Java Array entity attributes, as illustrated by this article. Mapping database ARRAY columns to java.util.List entity attributes is a much better approach than using the previous Java Array option since,… Read More