I have strange behavior with caching and JPA objects (EclipseLink 2.4.1) + GUICE PERSIST
I will not use caching, however I accidentally get an old instance that I have already changed in the MySQL database.
I tried the following:
<class>MyEntity</class> <shared-cache-mode>NONE</shared-cache-mode> <properties> <property name="eclipselink.cache.shared.default" value="false"/> <property name="eclipselink.cache.size.default" value="0"/> <property name="eclipselink.cache.type.default" value="None"/> <property name="eclipselink.refresh" value="true"/> <property name="eclipselink.query-results-cache" value="false"/> <property name="eclipselink.weaving" value="false"/> </properties>
Even activating the EclipseLink trace, I see a JPQL query:
ReadObjectQuery Execute the query (name = "readObject" referenceclass = XX sql = "... (just by making a call to" find "entityManager
but, but randomly returns the old value of this class.
Note
Perhaps it happens that to use different instances of EntityManager and each has its own cache? I saw the following related entry: Disable JPA cache EclipseLink 2.4 If so, you can clear the ALL EntityManager ALL cache without using: ???? . Em.getEntityManagerFactory () getCache () evictAll (). Is it possible to clear ALL caches without using evictALL?
source share