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

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.0.x@1341964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Heath Thomann 2012-05-23 18:08:56 +00:00
parent 05b525df49
commit 17ccc596c7
2 changed files with 13 additions and 8 deletions

View File

@ -4039,10 +4039,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
{