we're using EclipseLink in a two-tier architecture. We've already turned off the second level cache but are still experiencing problems with stale data regarding the find() method.
Is there any way to turn off L1 cache / identity map for those find() queries? At the moment we just do a refresh on the returned object but this just doesn't feel right.
I also use Eclipselink in a fat (Swing) client, with multiple EntityManagerFactories and one EM per window. We configure EL like this to disable all EMF level caching (EM is ok):
lOptions.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, "false"); // do not use the shared cache (otherwise refresh will not update from db)
(We use programmatic configuration, but there is a XML equivalent.)
An EntityManager must manage everything used in it persistence context. To avoid this, you must either create a new EntityManager (such as per transaction) or call clear() on the EntityManager.
EclipseLink also has support for a WEAK EntityManager.