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

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

View File

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