From f58557a5671f0d6d6fa994d9812975b2b8c56804 Mon Sep 17 00:00:00 2001 From: Guenther Demetz Date: Wed, 9 May 2012 16:41:49 +0200 Subject: [PATCH] HHH-7304 testcase --- .../jpa/naturalid/MutableNaturalIdTest.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/test/java/org/hibernate/test/jpa/naturalid/MutableNaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/jpa/naturalid/MutableNaturalIdTest.java index 2196d464f6..13e0d0b9b3 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/jpa/naturalid/MutableNaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/jpa/naturalid/MutableNaturalIdTest.java @@ -27,6 +27,7 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.test.jpa.AbstractJPATest; +import org.hibernate.testing.TestForIssue; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -37,7 +38,7 @@ import static org.junit.Assert.assertTrue; public class MutableNaturalIdTest extends AbstractJPATest { @Override protected Class[] getAnnotatedClasses() { - return new Class[] { Group.class }; + return new Class[] { Group.class, ClassWithIdentityColumn.class }; } @Test @@ -68,4 +69,19 @@ public class MutableNaturalIdTest extends AbstractJPATest { s.getTransaction().commit(); s.close(); } + + @Test + @TestForIssue( jiraKey = "HHH-7304") + public void testInLineSynchWithIdentityColumn() { + Session s = openSession(); + s.beginTransaction(); + ClassWithIdentityColumn e = new ClassWithIdentityColumn(); + e.setName("Dampf"); + s.save(e); + e.setName("Klein"); + assertNotNull(session.bySimpleNaturalId(ClassWithIdentityColumn.class).load("Klein")); + + session.getTransaction().rollback(); + session.close(); + } }