diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java index 5253b4db0..f7678e95b 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java @@ -3457,6 +3457,9 @@ public class BrokerImpl if (_transAdditions != null) { _transAdditions.clear(); } + if (_pending != null) { + _pending = null; + } if (_dmLite == null) { _dmLite = new DetachManagerLite(_conf); } diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java index 0d4a8b94f..9fd9fd102 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java @@ -45,6 +45,16 @@ public class TestDetachLite extends TestDetach { 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() { Object[] p = props; p[1] = "loaded(LiteAutoDetach=true,DetachProxyFields=false)";