OPENJPA-836 after em.clear the datacache is inconsistent

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@734551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2009-01-14 23:21:13 +00:00
parent b65b9b2471
commit 1583426e01
1 changed files with 9 additions and 0 deletions

View File

@ -269,8 +269,17 @@ public class PCDataImpl
return;
int index = fmd.getIndex();
OpenJPAStateManager dsm = null;
if (sm.getPersistenceCapable().pcIsDetached()) {
dsm = (DetachedStateManager) sm.getPersistenceCapable().
pcGetStateManager();
sm.getPersistenceCapable().pcReplaceStateManager(sm);
}
Object val = toData(fmd, sm.fetchField(index, false),
sm.getContext());
if (dsm != null)
sm.getPersistenceCapable().pcReplaceStateManager(dsm);
if (val != NULL)
setData(index, val);
else // unable to store field value; clear out any old values