HHH-9568 : EntityManager.flush() does not behave properly with transient one-to-one association and no cascade (reverts HHH-9330)
This commit is contained in:
parent
083e8cf52e
commit
d933c78185
|
@ -205,9 +205,7 @@ public class CascadeStyles {
|
||||||
public static final CascadeStyle DELETE_ORPHAN = new BaseCascadeStyle() {
|
public static final CascadeStyle DELETE_ORPHAN = new BaseCascadeStyle() {
|
||||||
@Override
|
@Override
|
||||||
public boolean doCascade(CascadingAction action) {
|
public boolean doCascade(CascadingAction action) {
|
||||||
return action == CascadingActions.DELETE ||
|
return action == CascadingActions.DELETE || action == CascadingActions.SAVE_UPDATE;
|
||||||
action == CascadingActions.SAVE_UPDATE ||
|
|
||||||
action == CascadingActions.PERSIST_ON_FLUSH;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,6 +30,7 @@ import javax.persistence.EntityManager;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
|
import org.hibernate.testing.FailureExpected;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -67,7 +68,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-9330")
|
@TestForIssue( jiraKey = "HHH-9568")
|
||||||
|
@FailureExpected( jiraKey = "HHH-9568" )
|
||||||
public void testOrphanedWhileManaged() {
|
public void testOrphanedWhileManaged() {
|
||||||
createData();
|
createData();
|
||||||
|
|
||||||
|
@ -100,7 +102,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-9330")
|
@TestForIssue( jiraKey = "HHH-9568")
|
||||||
|
@FailureExpected( jiraKey = "HHH-9568" )
|
||||||
public void testOrphanedWhileManagedMergeOwner() {
|
public void testOrphanedWhileManagedMergeOwner() {
|
||||||
createData();
|
createData();
|
||||||
|
|
||||||
|
@ -134,7 +137,8 @@ public class DeleteOneToManyOrphansTest extends BaseEntityManagerFunctionalTestC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue( jiraKey = "HHH-9330")
|
@TestForIssue( jiraKey = "HHH-9568")
|
||||||
|
@FailureExpected( jiraKey = "HHH-9568" )
|
||||||
public void testReplacedWhileManaged() {
|
public void testReplacedWhileManaged() {
|
||||||
createData();
|
createData();
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ public class OneToOneOrphanTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-9568")
|
@TestForIssue(jiraKey = "HHH-9568")
|
||||||
@FailureExpected(jiraKey = "HHH-9568")
|
|
||||||
public void testFlushTransientOneToOneNoCascade() throws Exception {
|
public void testFlushTransientOneToOneNoCascade() throws Exception {
|
||||||
EntityManager em = getOrCreateEntityManager();
|
EntityManager em = getOrCreateEntityManager();
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
|
|
Loading…
Reference in New Issue