From 7e1752cfb3fe08ed6abc0c2e41a68a048da49d37 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Tue, 18 Oct 2011 17:05:54 -0700 Subject: [PATCH] HHH-6744 : Skip MultiPathCircleCascadeTest.testMergeEntityWithNonNullableTransientEntity() when CHECK_NULLABILITY is false and sequence/increment generator is used --- ...ircleCascadeCheckNullibilityFalseTest.java | 12 ----------- ...ltiPathCircleCascadeDelayedInsertTest.java | 21 ------------------- .../circle/MultiPathCircleCascadeTest.java | 18 ++++++++++++++++ 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullibilityFalseTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullibilityFalseTest.java index 32e9e4f187..de48c60850 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullibilityFalseTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullibilityFalseTest.java @@ -23,13 +23,8 @@ */ package org.hibernate.test.cascade.circle; -import org.junit.Test; - import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.dialect.Oracle10gDialect; -import org.hibernate.dialect.PostgreSQLDialect; -import org.hibernate.testing.SkipForDialect; /** * @author Gail Badner @@ -40,11 +35,4 @@ public class MultiPathCircleCascadeCheckNullibilityFalseTest extends MultiPathCi super.configure( cfg ); cfg.setProperty( Environment.CHECK_NULLABILITY, "false" ); } - - @Override - @SkipForDialect(value = { Oracle10gDialect.class, PostgreSQLDialect.class }, comment = "This test is known to fail for dialects using a sequence for the native generator. See HHH-6744") - @Test - public void testMergeEntityWithNonNullableTransientEntity() { - super.testMergeEntityWithNonNullableTransientEntity(); - } } \ No newline at end of file diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeDelayedInsertTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeDelayedInsertTest.java index 6be0727452..bf4c54896d 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeDelayedInsertTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeDelayedInsertTest.java @@ -23,12 +23,6 @@ */ package org.hibernate.test.cascade.circle; -import org.hibernate.JDBCException; -import org.hibernate.PropertyValueException; -import org.hibernate.TransientObjectException; - -import static org.junit.Assert.assertTrue; - /** * @author Gail Badner */ @@ -39,19 +33,4 @@ public class MultiPathCircleCascadeDelayedInsertTest extends MultiPathCircleCasc "cascade/circle/MultiPathCircleCascadeDelayedInsert.hbm.xml" }; } - - @Override - protected void checkExceptionFromNullValueForNonNullable(Exception ex, boolean checkNullability, boolean isNullValue ) { - if ( checkNullability ) { - if ( isNullValue ) { - assertTrue( ex instanceof PropertyValueException ); - } - else { - assertTrue( ex instanceof TransientObjectException ); - } - } - else { - assertTrue( ex instanceof JDBCException || ex instanceof TransientObjectException ); - } - } } diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java index e75b855d17..f710dbacad 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/cascade/circle/MultiPathCircleCascadeTest.java @@ -35,6 +35,10 @@ import org.hibernate.engine.spi.SessionImplementor; import org.junit.Test; +import org.hibernate.id.IdentifierGenerator; +import org.hibernate.id.IncrementGenerator; +import org.hibernate.id.SequenceGenerator; +import org.hibernate.testing.SkipLog; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -90,6 +94,20 @@ public class MultiPathCircleCascadeTest extends BaseCoreFunctionalTestCase { @Test public void testMergeEntityWithNonNullableTransientEntity() { + // Skip if CHECK_NULLABILITY is false and route ID is a sequence or incrment generator (see HHH-6744) + IdentifierGenerator routeIdentifierGenerator = sessionFactory().getEntityPersister( Route.class.getName() ).getIdentifierGenerator(); + if ( ! sessionFactory().getSettings().isCheckNullability() && + ( SequenceGenerator.class.isInstance( routeIdentifierGenerator) || + IncrementGenerator.class.isInstance( routeIdentifierGenerator ) ) + ) { + SkipLog.reportSkip( + "delayed-insert without checking nullability", + "delayed-insert without checking nullability is known to fail when dirty-checking; see HHH-6744" + ); + return; + } + + Route route = getUpdatedDetachedEntity(); Node node = (Node) route.getNodes().iterator().next();