From d933c7818553e04ca18107649cda83154147b8cd Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Wed, 14 Jan 2015 15:06:53 -0800 Subject: [PATCH] HHH-9568 : EntityManager.flush() does not behave properly with transient one-to-one association and no cascade (reverts HHH-9330) --- .../java/org/hibernate/engine/spi/CascadeStyles.java | 4 +--- .../orphan/onetomany/DeleteOneToManyOrphansTest.java | 10 +++++++--- .../jpa/test/orphan/onetoone/OneToOneOrphanTest.java | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java index 8eacfbf9f0..be4ed381aa 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java @@ -205,9 +205,7 @@ public class CascadeStyles { public static final CascadeStyle DELETE_ORPHAN = new BaseCascadeStyle() { @Override public boolean doCascade(CascadingAction action) { - return action == CascadingActions.DELETE || - action == CascadingActions.SAVE_UPDATE || - action == CascadingActions.PERSIST_ON_FLUSH; + return action == CascadingActions.DELETE || action == CascadingActions.SAVE_UPDATE; } @Override diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetomany/DeleteOneToManyOrphansTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetomany/DeleteOneToManyOrphansTest.java index 67ad0b8722..d54befe398 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetomany/DeleteOneToManyOrphansTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetomany/DeleteOneToManyOrphansTest.java @@ -30,6 +30,7 @@ import javax.persistence.EntityManager; import org.junit.Test; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import static org.junit.Assert.assertEquals; @@ -67,7 +68,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC } @Test - @TestForIssue( jiraKey = "HHH-9330") + @TestForIssue( jiraKey = "HHH-9568") + @FailureExpected( jiraKey = "HHH-9568" ) public void testOrphanedWhileManaged() { createData(); @@ -100,7 +102,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC } @Test - @TestForIssue( jiraKey = "HHH-9330") + @TestForIssue( jiraKey = "HHH-9568") + @FailureExpected( jiraKey = "HHH-9568" ) public void testOrphanedWhileManagedMergeOwner() { createData(); @@ -134,7 +137,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC } @Test - @TestForIssue( jiraKey = "HHH-9330") + @TestForIssue( jiraKey = "HHH-9568") + @FailureExpected( jiraKey = "HHH-9568" ) public void testReplacedWhileManaged() { createData(); diff --git a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetoone/OneToOneOrphanTest.java b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetoone/OneToOneOrphanTest.java index b9d29ee16d..71a07fd42e 100644 --- a/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetoone/OneToOneOrphanTest.java +++ b/hibernate-entitymanager/src/test/java/org/hibernate/jpa/test/orphan/onetoone/OneToOneOrphanTest.java @@ -49,7 +49,6 @@ public class OneToOneOrphanTest extends BaseEntityManagerFunctionalTestCase { @Test @TestForIssue(jiraKey = "HHH-9568") - @FailureExpected(jiraKey = "HHH-9568") public void testFlushTransientOneToOneNoCascade() throws Exception { EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin();