11JPAHibernateQueryHints PDF
11JPAHibernateQueryHints PDF
JPA Hints
The retrieveMode hint supports the values USE and BYPASS and tells
Hibernate if it shall USE the second-level cache to retrieve an entity
or if it shall BYPASS it and get it directly from the database.
This hint defines how Hibernate shall write changed entities to the
second-level cache. It can either USE the cache to add entities to the
cache and updated existing ones, or BYPASS it for entities that are
not already stored in the cache and only update the existing ones or
REFRESH the entities located in the cache before they get retrieved
from it.
www.thoughts-on-java.org
11 JPA & Hibernate Query Hints
5. javax.persistence.loadgraph (EntityGraph)
You can read more about entity graphs in JPA 2.1 Entity Graph – Part
1: Named entity graphs and JPA 2.1 Entity Graph – Part 2: Define
lazy/eager loading at runtime.
6. javax.persistence.fetchgraph (EntityGraph)
You can read more about entity graphs in JPA 2.1 Entity Graph – Part
1: Named entity graphs and JPA 2.1 Entity Graph – Part 2: Define
lazy/eager loading at runtime .
www.thoughts-on-java.org
11 JPA & Hibernate Query Hints
Hibernate Hints
8. org.hibernate.readOnly (boolean)
If you will not apply any changes to the selected entities, you can set
the org.hibernate.readOnly hint to true. This allows Hibernate to
deactivate dirty checking for these entities and can provide a
performance benefit.
Hibernate provides the value of this hint to the JDBC driver to define
the number of rows the driver shall receive in one batch. This can
improve the communication between the JDBC driver and the
database, if it’s supported by the driver.
www.thoughts-on-java.org
11 JPA & Hibernate Query Hints
10. org.hibernate.comment (String – custom comment)
11. org.hibernate.cachable
www.thoughts-on-java.org