In this article, you are going to find out how to map an immutable entity when using JPA and Hibernate.
If your Domain Model requires that a given entity should not be modified by the data access logic, Hibernate can enforce this requirement if the entity is marked with the
Continue reading “How to map an immutable entity with JPA and Hibernate”
In this article, we are going to see how to use a UUID entity identifier that is auto-generated by Hibernate either in the JVM or using database-specific UUID functions.
Post entity looks as follows:
Post entity has a UUID identifier and a title. Now, let’s see how we can map the
Post entity so that the UUID identifier be auto-generated for us.
Continue reading “How to use a JVM or database auto-generated UUID identifier with JPA and Hibernate”
On the Hibernate forum, I noticed the following question which is about using the Hibernate Query Cache for storing DTO projections, not entities.
While caching JPQL queries which select entities is rather typical, caching DTO projections is a lesser-known feature of the Hibernate second-level Query Cache.
Continue reading “How to use the Hibernate Query Cache for DTO projections”
As previously explained, although Hibernate does not support database ARRAY column types by default, you can easily implement a custom Hibernate
ArrayType. While the previous solution worked on PostgreSQL, in this article, you are going to see that it is fairly easy to adapt it to HSQLDB.
Continue reading “Hibernate HSQLDB ARRAY Type”
hibernate-types project allows you to map Java objects or Jackson
JsonNode as JPA or Hibernate entity properties, and, thanks to our awesome contributors, we have added support for storing type-safe JSON collections.
In this article, you are going to see how to achieve this goal.
Continue reading “How to map JSON collections using JPA and Hibernate”