How to Map Json in Hibernate
Vlad Mihalcea posted “How to map JSON objects using generic Hibernate Types”, showing how you can use a library he wrote to map JSON columns from databases like MySQL and PostgreSQL (and Oracle and SQL Server, too) into JPA entities.
It’s done through a @TypeDef
and a library, Hibernate Types. Annotate the type properly, and Hibernate provides conversion from the JSON into a JPA entity (and back) as needed.
The only limit is apparently in querying - you can use native queries to scan the JSON entities, but JPQL and HQL are unaware of the types.