The most efficient way to improve the performance of a database query is to avoid it by retrieving the data from a local cache. That’s why Hibernate offers 3 different caches which are:
The 1st level cache that contains all entities loaded and created within the current session.
The 2nd level cache which is a shared, session-independent cache for entities.
And the query cache which is a shared, session-independent cache for the results of Criteria and JPQL queries.
In this video, I will focus on the query cache. It’s Hibernate-specific and the only one that doesn’t store entities. That makes it your only option if you want to cache DTO projections. If you want to dive deeper into this topic, please take a look at my Hibernate Performance Tuning Online Training, in which I explain all 3 caches in great details.
Links mentioned:
Hibernate Performance Tuning Online Training: https://thorben-janssen.com/hibernate...
7 Tips to boost your Hibernate performance: https://thorben-janssen.com/tips-to-b...
Hibernate Logging Guide: https://thorben-janssen.com/hibernate...
Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8
Join the free Member Library:
https://goo.gl/dtyIIC
Read the accompanying post: https://thorben-janssen.com/hibernate...
Want to connect with me?
Blog: https://thorben-janssen.com/
Twitter: / thjanssen123
Facebook: / thoughtsonjava
#Hibernate #DTO #Projections