OPENJPA-2136: Fix NPE when using LiteAutoDetach.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1292034 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2012-02-21 21:14:57 +00:00
parent c55f8469f1
commit 6599b7b403
2 changed files with 13 additions and 0 deletions

View File

@ -3457,6 +3457,9 @@ public class BrokerImpl
if (_transAdditions != null) { if (_transAdditions != null) {
_transAdditions.clear(); _transAdditions.clear();
} }
if (_pending != null) {
_pending = null;
}
if (_dmLite == null) { if (_dmLite == null) {
_dmLite = new DetachManagerLite(_conf); _dmLite = new DetachManagerLite(_conf);
} }

View File

@ -45,6 +45,16 @@ public class TestDetachLite extends TestDetach {
root = createData(); root = createData();
} }
public void testPendingClear() {
EntityManager em = emf.createEntityManager();
DMCustomer dm = em.find(DMCustomer.class, root.getId());
dm.setLastName(System.currentTimeMillis() + "--last");
em.clear();
em.getTransaction().begin();
// Pre OPENJPA-2136 this commit call would fail.
em.getTransaction().commit();
}
public void testLeaveProxy() { public void testLeaveProxy() {
Object[] p = props; Object[] p = props;
p[1] = "loaded(LiteAutoDetach=true,DetachProxyFields=false)"; p[1] = "loaded(LiteAutoDetach=true,DetachProxyFields=false)";