Hibernate / Hibernate Caching
Effect of native query on hibernate cache.
When using native SQL queries you have to address the risk of invalidating existing cache when query cache enabled.
Using SQLQuery, Hibernate couldn't know what cache regions you might affect, however you can explicitly provide the instruction. With the explicit instruction, hibernate know which query caches to invalidate, otherwise it may discard all the cache entries.
This only affects the second level cache.
More Related questions...