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”
While answering questions on the Hibernate forum, I stumbled on the following question. What was different than previous questions on the same topic was that the original poster realized the shortcoming of the JPA constructor expression which can be addressed elegantly by Hibernate.
Because this has been a recurring theme on StackOverflow and the Hibernate forum, I decided to dedicate an article to the best way of mapping DTO projections using JPA and Hibernate.
Continue reading “The best way to map a projection query to a DTO (Data Transfer Object) with JPA and Hibernate”