Hibernate disable Query Cache
Solution 1
I think the configuration you want is
hibernate.cache.use_query_cache = false
Solution 2
Could it be that you never saved or updated the the changed entry to hibernate? When the cache returns the wrong result that is usually an indication something else is wrong.
Solution 3
it has nothing to do with 2nd or Query caches, these are already disabled by default! What probably would help in your case is to call session.refresh(yourEntity)
so that the state of your entity would be re-read by hibernate.
Patrick
Updated on June 19, 2022Comments
-
Patrick almost 2 years
Following problem:
I create a Query to display all Entries of a MYSQL Table, if I edit a Field and execute the Query again I get the same (old) Result as in the first query.
It seems that Hibernate caches the Result. I tried to disable Caching with
query.setCachable(false)
"hibernate.cache.use_second_level_cache"
"cache.provider_class"
"org.hibernate.cacheable"
flushing and closing the session
but nothing works