The hibernate-types open-source project is born

Introduction Recently, I got a very interesting request from one of my readers. Since I’ve been providing many custom types to support JSON, ARRAY or nullable Character types, I decided to start a new open-source project to make it easier for you to get this extra Hibernate Types.

How to map Java and SQL arrays with JPA and Hibernate

Introduction Hibernate custom Types allow you to map all sorts of database specific column types, like IP address, JSON columns, bit sets or SQL arrays. There are two ways to define a custom Hibernate Type: the UserType interface Java and SQL descriptors The latter option is preferred since it allows you to better split the Java-to-JDBC and the JDBC-to-SQL type handling. In this article, we are going to see how you can map SQL arrays to their Java counterpart.

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 implement a custom basic type using Hibernate UserType

Introduction StackOverflow is a gold mine! Check out this question I bumped into this morning. Basically, our Hibernate user wants a resilient CharacterType which works with NULL or empty values. To make it even more interesting, we are going to make it work even if the underlying database column contains more than one character.

How to map JSON objects using generic Hibernate Types

Introduction Since not all relational database systems support JSON types, Hibernate does not come with a built-in JSON Type mapper. Traditionally, all custom types have been supplied via a UserType implementation. However, a UserType is not very developer-friendly so, in this post, I’m going to show how you can do a better job using AbstractSingleColumnStandardBasicType instead.