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
To disable second-level caching (say for debugging purposes), we just set the hibernate. cache. use_second_level_cache property to false.
A - Query level cache is an optional feature.
The Hibernate query cache is supported. Every cache provider is not compatible with every concurrency strategy.
Hibernate first level cache is enabled by default and there is no way to disable it. However hibernate provides methods using which selected objects can be deleted from the cache or clear the cache completely.
I think the configuration you want is
hibernate.cache.use_query_cache = false
Reference.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With