I am a new to java/spring/hibernate and really felt in love in java after several years of . now I am working on web app using Spring (MVC, declarative transactions) and Hibernate (3.6, as cache provier - eh Cache 2.5).
I've got some read only and read-write enitties that I would like to cache using Hibernate second cache and query cache.
For read-write entities I am facing with the issue of non repeatable read. there are several concurrent threads reading and writing to entity table.
Thread 3 gets lookup values: ,304 DEBUG [http-bio-8080-exec-3] cache.
I have a question regarding Hibernate caching mechanism.
I have read in the articles that native SQLquery execution in hibernate, invalidates all regions of cache because hibernate does not have any idea regarding which particular entity it is going to affect.
If you execute: Insert or Delete native query, then cache will not be invalidated. This article explains how the Hibernate query cache works and the effect of native queries over existing cache entries. Session) is not cleared every time you run a native query, because that would detach all your current "attached entities", having unexpected consequences in entity state expectations.
The following is a complete listing of fixes for V8.5 with the most recent fix at the top.A whole region would get invalidated, not the whole second level cache.An entity defines a cache region, so updating a specific entity table would only remove all the entities that belong to that particular table(s) that were affected by the native query.Get notified of your software’s bugs as they happen!has error tracking solutions for every major programming language and platform - Start a free trial in under a minute!