Java Map to JSON mapping with JPA and Hibernate

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

How to return a Map result from a JPA or Hibernate query

Introduction In this article, I’m going to show you how you can return a Java Map result when executing a JPA query. I decided to write this article after answering a similar question on StackOverflow.