HHH-9568/HHH-9571 fix orphanRemoval in JPA bootstrap
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
faff6f0b8f
commit
20d26a0126
|
@ -197,7 +197,8 @@ public final class CascadeStyles {
|
|||
@Override
|
||||
public boolean doCascade(CascadingAction action) {
|
||||
return action == CascadingActions.DELETE
|
||||
|| action == CascadingActions.SAVE_UPDATE //WHAT??
|
||||
|| action == CascadingActions.SAVE_UPDATE
|
||||
|| action == CascadingActions.PERSIST_ON_FLUSH
|
||||
|| action == CascadingActions.CHECK_ON_FLUSH;
|
||||
}
|
||||
|
||||
|
@ -307,7 +308,7 @@ public final class CascadeStyles {
|
|||
@Override
|
||||
public boolean doCascade(CascadingAction action) {
|
||||
if ( action == CascadingActions.CHECK_ON_FLUSH ) {
|
||||
return !doCascade( CascadingActions.PERSIST_ON_FLUSH );
|
||||
return !reallyDoCascade( CascadingActions.PERSIST_ON_FLUSH );
|
||||
}
|
||||
for ( CascadeStyle style : styles ) {
|
||||
if ( style.doCascade( action ) ) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.List;
|
|||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.Jpa;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -56,7 +55,7 @@ public class DeleteOneToManyOrphansTest {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-9568")
|
||||
@FailureExpected( jiraKey = "HHH-9568" )
|
||||
// @FailureExpected( jiraKey = "HHH-9568" )
|
||||
public void testOrphanedWhileManaged(EntityManagerFactoryScope scope) {
|
||||
Long productId = scope.fromTransaction(
|
||||
entityManager -> {
|
||||
|
@ -85,7 +84,7 @@ public class DeleteOneToManyOrphansTest {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-9568")
|
||||
@FailureExpected( jiraKey = "HHH-9568" )
|
||||
// @FailureExpected( jiraKey = "HHH-9568" )
|
||||
public void testOrphanedWhileManagedMergeOwner(EntityManagerFactoryScope scope) {
|
||||
Long productId = scope.fromTransaction(
|
||||
entityManager -> {
|
||||
|
@ -115,7 +114,7 @@ public class DeleteOneToManyOrphansTest {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-9568")
|
||||
@FailureExpected( jiraKey = "HHH-9568" )
|
||||
// @FailureExpected( jiraKey = "HHH-9568" )
|
||||
public void testReplacedWhileManaged(EntityManagerFactoryScope scope) {
|
||||
Long featureNewId = scope.fromTransaction(
|
||||
entityManager -> {
|
||||
|
|
|
@ -30,7 +30,7 @@ public class A implements Serializable {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@OneToOne(targetEntity=B.class, mappedBy="a", orphanRemoval = true)
|
||||
@OneToOne(mappedBy = "a", orphanRemoval = true)
|
||||
public B getB() {
|
||||
return b;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ public class B implements Serializable {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
@OneToOne(targetEntity=A.class, cascade=CascadeType.ALL,optional = true, orphanRemoval = true)
|
||||
@JoinColumn(name="FK_FOR_B")
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "FK_FOR_B")
|
||||
public A getA() {
|
||||
return a;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue