Reloading of persisted entity

Posted by Udi on Stack Overflow See other posts from Stack Overflow or by Udi
Published on 2010-01-12T13:15:55Z Indexed on 2010/04/07 1:33 UTC
Read the original article Hit count: 411

Filed under:
|
|

I'm using OpenJPA in my application as a JPA vendor.

The question is theoretical or conceptual:

Is there any way to tell an entity manager to load an entity from the DB rather than from it's cache?

The problematic scenario:

EM1.persist(Entity1)
EM2.merge(Entity1)
EM1.find(Entity1)  <--- Entity1 is the cached version rather than the merged one..

Any elegant way to do it? I really don't want to call em.refresh(entity).

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa