From 9a68cd613469b6788d1f2f8a252ca76f25b12da7 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 16 May 2024 22:57:58 +0200 Subject: [PATCH] HHH-12251 fix and enable @FailureExpected test Signed-off-by: Gavin King --- .../orm/test/id/IdClassManyToOneCascadeTest.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/id/IdClassManyToOneCascadeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/id/IdClassManyToOneCascadeTest.java index 26a19e176f..a6499b2456 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/id/IdClassManyToOneCascadeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/id/IdClassManyToOneCascadeTest.java @@ -16,7 +16,6 @@ import jakarta.persistence.ManyToOne; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; -import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import org.junit.Test; @@ -38,7 +37,6 @@ public class IdClassManyToOneCascadeTest extends BaseEntityManagerFunctionalTest } @Test - @FailureExpected( jiraKey = "HHH-12251") public void testMergeCascadesToManyToOne() { doInJPA( this::entityManagerFactory, entityManager -> { @@ -49,9 +47,9 @@ public class IdClassManyToOneCascadeTest extends BaseEntityManagerFunctionalTest someEntity.setId( 23L ); someEntity.setReferencedEntity( referencedEntity ); - entityManager.merge( someEntity ); + SomeEntity merged = entityManager.merge(someEntity); - assertTrue( entityManager.contains( referencedEntity ) ); + assertTrue( entityManager.contains( merged.getReferencedEntity() ) ); } ); } @@ -80,7 +78,7 @@ public class IdClassManyToOneCascadeTest extends BaseEntityManagerFunctionalTest private long id; @Id - @ManyToOne(cascade = CascadeType.PERSIST) + @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) private ReferencedEntity referencedEntity; public ReferencedEntity getReferencedEntity() {