OPENJPA-2107: Applied to 2.1.x Rick's changes from trunk (2.2.x)

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1342138 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Heath Thomann 2012-05-24 04:34:15 +00:00
parent beab029dad
commit 0148ee0d79
2 changed files with 13 additions and 8 deletions

View File

@ -4083,10 +4083,11 @@ public class BrokerImpl
lock();
try {
switch (status) {
case STATUS_INIT:
if (_compat.getResetFlushFlagForCascadePersist()){//OPENJPA-2051
_flags &= ~FLAG_FLUSHED;
}
case STATUS_INIT:
// Only reset the flushed flag is this is a new instance.
if (sm.isNew() && _compat.getResetFlushFlagForCascadePersist()) {// OPENJPA-2051
_flags &= ~FLAG_FLUSHED;
}
_cache.add(sm);
break;
case STATUS_TRANSIENT:

View File

@ -51,12 +51,16 @@ public class TestSimple extends BaseQueryTest {
{
EntityManager em = currentEntityManager();
startTx(em);
List l = em.createQuery("SELECT o FROM Entity1 o "
+ "WHERE o.stringField = 'testSimple'").getResultList();
assertSize(1, l);
endTx(em);
em.persist(new Entity1(1, "testSimple", 12));
List<Entity1> l =
em.createQuery("SELECT o FROM Entity1 o " + "WHERE o.stringField = 'testSimple'", Entity1.class)
.getResultList();
assertSize(2, l);
rollbackTx(em);
em.clear();
endEm(em);
}
// test Update
{