How to map a PostgreSQL HStore entity property with JPA and Hibernate

Introduction The open-source hibernate-types project allows you to map a great variety of database types that are not supported natively by Hibernate ORM (e.g. JSON, ARRAY, YearMonth, Month, INET addresses). In this article, we are going to see how you can map a PostgreSQL HStore type, which allows you to store key/value pairs, to a Java Map entity property when using JPA and Hibernate.

How to map a PostgreSQL Enum ARRAY to a JPA entity property using Hibernate

Introduction The open-source hibernate-types project allows you to map JSON, ARRAY, YearMonth, Month or database-specific columns (e.g. INET addresses). In this article, we are going to see how you can map a PostgreSQL Enum ARRAY type to a Java array entity property when using JPA and Hibernate.

How to bind custom Hibernate parameter types to JPA queries

Introduction In this article, we are going to see how we can bind a custom Hibernate parameter type to a JPA query. I decided to write this article after one of my hibernate-types framework users created this very interesting issue on GitHub.

How to map java.time.Year and java.time.Month with JPA and Hibernate

Introduction In this article, we are going to see how you can map the java.time.Year and java.time.Month with both JPA and Hibernate. As explained in this article, JPA 2.2 supports LocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime from the java.time package. Hibernate has been supporting the Java 8 Date/Time classes since 5.0 via the hibernate-java8 dependency, but since version 5.2, this dependency was merged with hibernate-core so you get the Duration, Instant and ZonedDateTime types in addition to the ones supported by JPA 2.2. However, neither JPA nor Hibernate supports the java.time.Year type out-of-the-box…. Read More

How to map the PostgreSQL inet type with JPA and Hibernate

Introduction In this article, we are going to see how to map the PostgreSQL inet type with JPA and Hibernate. Traditionally, PostgreSQL has been offering more column types than other relational database systems. Previously, I showed you how to map JSON and ARRAY as Hibernate Types, and mapping the PostgreSQL inet type is going to be just as easy. You don’t even have to implement these types since they are available via the hibernate-types project.

New Video Course