I am using EJB3/Hibernate3 and I am having problem with my query picking up data updated by another user or application unless a new session is initiated or entity manager is cleared.
I have tried my best with all configurations to the best of my knowledge. I could not find a way to force the query to pick up fresh data from the database. Any help will be very much appreciated.
I have tried this:
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
also at the query level:
emqry.setHint("org.hibernate.cacheable",new Boolean(false));
// logger.info("org.hibernate.cacheable is false");
// emqry.setHint("org.hibernate.cacheMode",org.hibernate.CacheMode.REFRESH);
// logger.info("org.hibernate.cacheMode REFRESH");
logger.info("Query Impl "+emqry.getClass().getName());
//emqry.setHint()
// emqry.setFlushMode(javax.persistence.FlushModeType.AUTO);
None of these settings are forcing my query to pick up fresh data. Also
implemented my own cache provider which does nothing and passed it through hibernate.cache.provider_class property. None of the properties I set above is changing the behaviour.
PLEASE, ANY HELP OR HINTS TO PIONT ME IN THE RIGHT DIRECTION as this is a major issue for our development work.
I tested with local HSQL database which seems to work fine.
|