Hibernate / EclipseLink Interview questions
What are EclipseLink query hints?
Query hints are provider-specific settings passed to a JPA query via setHint(), letting an application tune how EclipseLink executes that particular query without changing standard JPQL. Because hints are outside the JPA specification, unrecognized hints are simply ignored by other providers rather than causing an error, which keeps queries portable even when hints are used.
TypedQuery<Employee> query = em.createQuery( "SELECT e FROM Employee e WHERE e.department = :dept", Employee.class); query.setHint("eclipselink.join-fetch", "e.address"); query.setHint("eclipselink.batch", "e.projects"); query.setHint("eclipselink.cache-usage", "CheckCacheOnly");
Common hints control fetching strategy (join-fetch, batch), cache behavior (cache-usage, refresh), and query optimization (read-only for entities that will never be modified, which skips change-tracking overhead entirely).
More Related questions...