Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Get old entity even after caching is disabled.
Get old entity even after caching is disabled. [message #1389440] Fri, 27 June 2014 20:36 Go to next message
Dave Tiger is currently offline Dave TigerFriend
Messages: 4
Registered: June 2014
Junior Member
Using eclipseLink 2.5.1.
A new EntityManager is created for each HTTP request, and it is bound to the request with threadLocal.

HTTP request 1: update entity A (type Foo)
HTTP request 2: list all entities of type Foo. the entity A is not changed, still old entity.

From console, I can see SQL statement logging for both requests, no problems. but I am not sure whether issuing SQL statements indicates retrieving entities from database.

After disable caching in persistence.xml, still got the same results(old entity) after updating the entity in previous HTTP request.

<shared-cache-mode>NONE</shared-cache-mode>

or

<property name="javax.persistence.sharedCache.mode" value="NONE"/>
<property name="eclipselink.query-results-cache" value="false"/>
<property name="eclipselink.cache.shared.default" value="false"/>

Any one has idea what is wrong? It should work even when L2 cache is on because all updates and query are using JPA. Thanks.

Re: Get old entity even after caching is disabled. [message #1391132 is a reply to message #1389440] Mon, 30 June 2014 13:43 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
The settings you have configured turn off the shared cache, but an EntityManager is required to cache all managed entities - any entity that is read through an EntityManager is required to be tracked for changes. If you are keeping an EntityManager for the life of a http request, if the client already read in an entity at the beginning, it will never see changes to that entity made after that point. You will either need to clear the EntityManager or obtain a new one.
Previous Topic:EclipseLink Performance (vs. OpenJPA)
Next Topic:Best type for JPA version field for Optimistic locking
Goto Forum:
  


Current Time: Fri Mar 29 05:09:58 GMT 2024

Powered by FUDForum. Page generated in 0.02047 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top