diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java similarity index 60% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java index d52e91928b..92bb5e6b3e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithManyToManyTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.util.Iterator; import javax.persistence.PersistenceException; @@ -12,60 +12,61 @@ import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; -import org.hibernate.MappingException; import org.hibernate.StaleObjectStateException; import org.hibernate.StaleStateException; -import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; +import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.metamodel.MappingMetamodel; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.junit.Test; +import org.hibernate.testing.orm.junit.SessionFactory; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.hibernate.testing.orm.junit.ExtraAssertions.assertTyping; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; /** * @author Gail Badner */ -public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctionalTestCase { +@SessionFactory(generateStatistics = true) +public abstract class AbstractEntityWithManyToManyTest { private boolean isPlanContractsInverse; private boolean isPlanContractsBidirectional; private boolean isPlanVersioned; private boolean isContractVersioned; - @Override - public void configure(Configuration cfg) { - cfg.setProperty( Environment.GENERATE_STATISTICS, "true" ); - } - @Override - protected void prepareTest() throws Exception { - super.prepareTest(); - isPlanContractsInverse = sessionFactory().getCollectionPersister( Plan.class.getName() + ".contracts" ) + @BeforeEach + protected void prepareTest(SessionFactoryScope scope) throws Exception { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + MappingMetamodel domainModel = sessionFactory.getDomainModel(); + isPlanContractsInverse = domainModel.getCollectionDescriptor( Plan.class.getName() + ".contracts" ) .isInverse(); try { - sessionFactory().getCollectionPersister( Contract.class.getName() + ".plans" ); + domainModel.getCollectionDescriptor( Contract.class.getName() + ".plans" ); isPlanContractsBidirectional = true; } - catch (MappingException ex) { + catch (IllegalArgumentException ex) { isPlanContractsBidirectional = false; } - isPlanVersioned = sessionFactory().getEntityPersister( Plan.class.getName() ).isVersioned(); - isContractVersioned = sessionFactory().getEntityPersister( Contract.class.getName() ).isVersioned(); - sessionFactory().getStatistics().clear(); + isPlanVersioned = sessionFactory.getEntityPersister( Plan.class.getName() ).isVersioned(); + isContractVersioned = sessionFactory.getEntityPersister( Contract.class.getName() ).isVersioned(); + sessionFactory.getStatistics().clear(); } @Test - public void testUpdateProperty() { - clearCounts(); + public void testUpdateProperty(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = new Plan( "plan" ); p.addContract( new Contract( null, "gail", "phone" ) ); @@ -73,11 +74,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = getPlan( s ); p.setDescription( "new plan" ); @@ -87,10 +88,10 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - clearCounts(); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = getPlan( s ); assertEquals( 1, p.getContracts().size() ); @@ -106,15 +107,17 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyManyToManyCollectionOfNew() { - clearCounts(); + public void testCreateWithNonEmptyManyToManyCollectionOfNew(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); - inTransaction( + clearCounts( sessionFactory ); + + scope.inTransaction( s -> { Plan p = new Plan( "plan" ); p.addContract( new Contract( null, "gail", "phone" ) ); @@ -122,11 +125,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = getPlan( s ); assertEquals( 1, p.getContracts().size() ); @@ -142,24 +145,26 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyManyToManyCollectionOfExisting() { - clearCounts(); + public void testCreateWithNonEmptyManyToManyCollectionOfExisting(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Contract c = new Contract( null, "gail", "phone" ); - inTransaction( + scope.inTransaction( s -> s.persist( c ) ); - assertInsertCount( 1 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = new Plan( "plan" ); p.addContract( c ); @@ -167,11 +172,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -186,26 +191,28 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testAddNewManyToManyElementToPersistentEntity() { - clearCounts(); + public void testAddNewManyToManyElementToPersistentEntity(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); - inTransaction( + scope.inTransaction( s -> { s.persist( p ); } ); - assertInsertCount( 1 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = s.get( Plan.class, p.getId() ); assertEquals( 0, p.getContracts().size() ); @@ -213,11 +220,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -232,28 +239,30 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testAddExistingManyToManyElementToPersistentEntity() { - clearCounts(); + public void testAddExistingManyToManyElementToPersistentEntity(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); - inTransaction( + scope.inTransaction( s -> { s.persist( p ); s.persist( c ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = s.get( Plan.class, p.getId() ); assertEquals( 0, p1.getContracts().size() ); @@ -265,11 +274,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 0 ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0, sessionFactory ); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -283,38 +292,40 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithEmptyManyToManyCollectionUpdateWithExistingElement() { - clearCounts(); + public void testCreateWithEmptyManyToManyCollectionUpdateWithExistingElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); - inTransaction( + scope.inTransaction( s -> { s.persist( p ); s.persist( c ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.update( p ) ); - assertInsertCount( 0 ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0, sessionFactory ); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -328,37 +339,39 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyManyToManyCollectionUpdateWithNewElement() { - clearCounts(); + public void testCreateWithNonEmptyManyToManyCollectionUpdateWithNewElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); Contract newC = new Contract( null, "sherman", "telepathy" ); p.addContract( newC ); - inTransaction( + scope.inTransaction( s -> s.update( p ) ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 2, p1.getContracts().size() ); @@ -382,39 +395,41 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3, sessionFactory ); } @Test - public void testCreateWithEmptyManyToManyCollectionMergeWithExistingElement() { - clearCounts(); + public void testCreateWithEmptyManyToManyCollectionMergeWithExistingElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); - inTransaction( + scope.inTransaction( s -> { s.persist( p ); s.persist( c ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.merge( p ) ); - assertInsertCount( 0 ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0, sessionFactory ); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -428,37 +443,39 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyManyToManyCollectionMergeWithNewElement() { - clearCounts(); + public void testCreateWithNonEmptyManyToManyCollectionMergeWithNewElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); Contract newC = new Contract( null, "yogi", "mail" ); p.addContract( newC ); - inTransaction( + scope.inTransaction( s -> s.merge( p ) ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 2, p1.getContracts().size() ); @@ -479,40 +496,42 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3, sessionFactory ); } @Test - public void testRemoveManyToManyElementUsingUpdate() { - clearCounts(); + public void testRemoveManyToManyElementUsingUpdate(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.removeContract( c ); assertEquals( 0, p.getContracts().size() ); if ( isPlanContractsBidirectional ) { assertEquals( 0, c.getPlans().size() ); } - inTransaction( + scope.inTransaction( s -> s.update( p ) ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 0 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + assertDeleteCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); if ( isPlanContractsInverse ) { @@ -534,43 +553,45 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testRemoveManyToManyElementUsingUpdateBothSides() { - clearCounts(); + public void testRemoveManyToManyElementUsingUpdateBothSides(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.removeContract( c ); assertEquals( 0, p.getContracts().size() ); if ( isPlanContractsBidirectional ) { assertEquals( 0, c.getPlans().size() ); } - inTransaction( + scope.inTransaction( s -> { s.update( p ); s.update( c ); } ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - assertDeleteCount( 0 ); - clearCounts(); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + assertDeleteCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 0, p1.getContracts().size() ); @@ -584,25 +605,27 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testRemoveManyToManyElementUsingMerge() { - clearCounts(); + public void testRemoveManyToManyElementUsingMerge(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.removeContract( c ); assertEquals( 0, p.getContracts().size() ); @@ -610,15 +633,15 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona assertEquals( 0, c.getPlans().size() ); } - inTransaction( + scope.inTransaction( s -> s.merge( p ) ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 0 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + assertDeleteCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); if ( isPlanContractsInverse ) { @@ -640,25 +663,27 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testRemoveManyToManyElementUsingMergeBothSides() { - clearCounts(); + public void testRemoveManyToManyElementUsingMergeBothSides(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.removeContract( c ); assertEquals( 0, p.getContracts().size() ); @@ -666,18 +691,18 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona assertEquals( 0, c.getPlans().size() ); } - inTransaction( + scope.inTransaction( s -> { s.merge( p ); s.merge( c ); } ); - assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0 ); - assertDeleteCount( 0 ); - clearCounts(); + assertUpdateCount( isContractVersioned && isPlanVersioned ? 2 : 0, sessionFactory ); + assertDeleteCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 0, p1.getContracts().size() ); @@ -691,27 +716,29 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testDeleteManyToManyElement() { - clearCounts(); + public void testDeleteManyToManyElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { s.update( p ); p.removeContract( c ); @@ -719,11 +746,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 0, p1.getContracts().size() ); @@ -734,25 +761,27 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testRemoveManyToManyElementByDelete() { - clearCounts(); + public void testRemoveManyToManyElementByDelete(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract c = new Contract( null, "gail", "phone" ); p.addContract( c ); - inTransaction( + scope.inTransaction( s -> s.persist( p ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); p.removeContract( c ); assertEquals( 0, p.getContracts().size() ); @@ -760,18 +789,18 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona assertEquals( 0, c.getPlans().size() ); } - inTransaction( + scope.inTransaction( s -> { s.update( p ); s.delete( c ); } ); - assertUpdateCount( isPlanVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isPlanVersioned ? 1 : 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 0, p1.getContracts().size() ); @@ -780,26 +809,28 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testManyToManyCollectionOptimisticLockingWithMerge() { - clearCounts(); + public void testManyToManyCollectionOptimisticLockingWithMerge(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan pOrig = new Plan( "plan" ); Contract cOrig = new Contract( null, "gail", "phone" ); pOrig.addContract( cOrig ); - inTransaction( + scope.inTransaction( s -> s.persist( pOrig ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = s.get( Plan.class, pOrig.getId() ); Contract newC = new Contract( null, "sherman", "note" ); @@ -808,11 +839,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inSession( + scope.inSession( s -> { pOrig.removeContract( cOrig ); try { @@ -820,8 +851,8 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona assertFalse( isContractVersioned ); } catch (PersistenceException ex) { - assertTyping(StaleObjectStateException.class, ex.getCause()); - assertTrue( isContractVersioned); + assertTyping( StaleObjectStateException.class, ex.getCause() ); + assertTrue( isContractVersioned ); } finally { s.getTransaction().rollback(); @@ -830,8 +861,7 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona ); - - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); s.delete( p1 ); @@ -839,26 +869,28 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3, sessionFactory ); } @Test - public void testManyToManyCollectionOptimisticLockingWithUpdate() { - clearCounts(); + public void testManyToManyCollectionOptimisticLockingWithUpdate(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan pOrig = new Plan( "plan" ); Contract cOrig = new Contract( null, "gail", "phone" ); pOrig.addContract( cOrig ); - inTransaction( + scope.inTransaction( s -> s.persist( pOrig ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p = s.get( Plan.class, pOrig.getId() ); Contract newC = new Contract( null, "yogi", "pawprint" ); @@ -866,11 +898,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inSession( + scope.inSession( s -> { s.beginTransaction(); pOrig.removeContract( cOrig ); @@ -882,7 +914,7 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona catch (PersistenceException ex) { s.getTransaction().rollback(); assertTrue( isContractVersioned ); - if ( !sessionFactory().getSessionFactoryOptions().isJdbcBatchVersionedData() ) { + if ( !scope.getSessionFactory().getSessionFactoryOptions().isJdbcBatchVersionedData() ) { assertTyping( StaleObjectStateException.class, ex.getCause() ); } else { @@ -892,7 +924,7 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); s.delete( p1 ); @@ -903,23 +935,25 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } @Test - public void testMoveManyToManyElementToNewEntityCollection() { - clearCounts(); + public void testMoveManyToManyElementToNewEntityCollection(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); - inTransaction( + scope.inTransaction( s -> { p.addContract( new Contract( null, "gail", "phone" ) ); s.persist( p ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); Plan p2 = new Plan( "new plan" ); - inTransaction( + scope.inTransaction( s -> { Plan p1 = getPlan( s ); assertEquals( 1, p1.getContracts().size() ); @@ -935,11 +969,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 1 ); - assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p3 = getPlan( s, p.getId() ); Plan p4 = getPlan( s, p2.getId() ); @@ -969,31 +1003,33 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3, sessionFactory ); } @Test - public void testMoveManyToManyElementToExistingEntityCollection() { - clearCounts(); + public void testMoveManyToManyElementToExistingEntityCollection(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts( sessionFactory ); Plan p = new Plan( "plan" ); Contract contract = new Contract( null, "gail", "phone" ); p.addContract( contract ); Plan p2 = new Plan( "plan2" ); - inTransaction( + scope.inTransaction( s -> { s.persist( p ); s.persist( p2 ); } ); - assertInsertCount( 3 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 3, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p3 = getPlan( s, p.getId() ); assertEquals( 1, p3.getContracts().size() ); @@ -1006,11 +1042,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 0 ); - assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0, sessionFactory ); + assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p3 = getPlan( s, p2.getId() ); Contract c1 = getContract( s, contract.getId() ); @@ -1018,11 +1054,11 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertInsertCount( 0 ); - assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0, sessionFactory ); + assertUpdateCount( isPlanVersioned && isContractVersioned ? 2 : 0, sessionFactory ); + clearCounts( sessionFactory ); - inTransaction( + scope.inTransaction( s -> { Plan p3 = getPlan( s, p.getId() ); Plan p4 = getPlan( s, p2.getId() ); @@ -1052,8 +1088,8 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3, sessionFactory ); } private void assertAllPlansAndContractsAreDeleted(SessionImplementor s) { @@ -1105,22 +1141,22 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona return s.createQuery( criteriaContractRowCount ).uniqueResult(); } - protected void clearCounts() { - sessionFactory().getStatistics().clear(); + protected void clearCounts(SessionFactoryImplementor sessionFactory) { + sessionFactory.getStatistics().clear(); } - protected void assertInsertCount(int expected) { - int inserts = (int) sessionFactory().getStatistics().getEntityInsertCount(); - assertEquals( "unexpected insert count", expected, inserts ); + protected void assertInsertCount(int expected, SessionFactoryImplementor sessionFactory) { + int inserts = (int) sessionFactory.getStatistics().getEntityInsertCount(); + assertEquals( expected, inserts, "unexpected insert count" ); } - protected void assertUpdateCount(int expected) { - int updates = (int) sessionFactory().getStatistics().getEntityUpdateCount(); - assertEquals( "unexpected update counts", expected, updates ); + protected void assertUpdateCount(int expected, SessionFactoryImplementor sessionFactory) { + int updates = (int) sessionFactory.getStatistics().getEntityUpdateCount(); + assertEquals( expected, updates, "unexpected update counts" ); } - protected void assertDeleteCount(int expected) { - int deletes = (int) sessionFactory().getStatistics().getEntityDeleteCount(); - assertEquals( "unexpected delete counts", expected, deletes ); + protected void assertDeleteCount(int expected, SessionFactoryImplementor sessionFactory) { + int deletes = (int) sessionFactory.getStatistics().getEntityDeleteCount(); + assertEquals( expected, deletes, "unexpected delete counts" ); } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java similarity index 62% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java index 3704d5c1ec..78810cc47f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/AbstractEntityWithOneToManyTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import javax.persistence.PersistenceException; import javax.persistence.criteria.CriteriaBuilder; @@ -14,35 +14,35 @@ import javax.persistence.criteria.Root; import org.hibernate.QueryException; import org.hibernate.StaleObjectStateException; import org.hibernate.StaleStateException; -import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; +import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.metamodel.MappingMetamodel; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.junit.Test; +import org.hibernate.testing.orm.junit.SessionFactory; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.hibernate.testing.orm.junit.ExtraAssertions.assertTyping; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; /** * @author Gail Badner */ @SuppressWarnings({ "UnusedDeclaration" }) -public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctionalTestCase { +@SessionFactory(generateStatistics = true) +public abstract class AbstractEntityWithOneToManyTest { private boolean isContractPartiesInverse; private boolean isContractPartiesBidirectional; private boolean isContractVariationsBidirectional; private boolean isContractVersioned; - public void configure(Configuration cfg) { - cfg.setProperty( Environment.GENERATE_STATISTICS, "true" ); - } - protected boolean checkUpdateCountsAfterAddingExistingElement() { return true; } @@ -51,43 +51,48 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional return true; } - protected void prepareTest() throws Exception { - super.prepareTest(); - isContractPartiesInverse = sessionFactory().getCollectionPersister( Contract.class.getName() + ".parties" ) + @BeforeEach + protected void prepareTest(SessionFactoryScope scope) throws Exception { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + MappingMetamodel domainModel = sessionFactory.getDomainModel(); + + isContractPartiesInverse = domainModel.getCollectionDescriptor( Contract.class.getName() + ".parties" ) .isInverse(); try { - sessionFactory().getEntityPersister( Party.class.getName() ).getPropertyType( "contract" ); + domainModel.getEntityDescriptor( Party.class.getName() ).getPropertyType( "contract" ); isContractPartiesBidirectional = true; } catch (QueryException ex) { isContractPartiesBidirectional = false; } try { - sessionFactory().getEntityPersister( ContractVariation.class.getName() ).getPropertyType( "contract" ); + domainModel.getEntityDescriptor( ContractVariation.class.getName() ).getPropertyType( "contract" ); isContractVariationsBidirectional = true; } catch (QueryException ex) { isContractVariationsBidirectional = false; } - isContractVersioned = sessionFactory().getEntityPersister( Contract.class.getName() ).isVersioned(); + isContractVersioned = domainModel.getEntityDescriptor( Contract.class.getName() ).isVersioned(); } @Test - public void testUpdateProperty() { - clearCounts(); + public void testUpdateProperty(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); contract.addParty( new Party( "party" ) ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); @@ -99,10 +104,10 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - clearCounts(); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); // c = (Contract) s.createCriteria( Contract.class ).uniqueResult(); @@ -119,25 +124,27 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyOneToManyCollectionOfNew() { - clearCounts(); + public void testCreateWithNonEmptyOneToManyCollectionOfNew(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); contract.addParty( new Party( "party" ) ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 1, c.getParties().size() ); @@ -151,35 +158,37 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyOneToManyCollectionOfExisting() { - clearCounts(); + public void testCreateWithNonEmptyOneToManyCollectionOfExisting(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Party firstParty = new Party( "party" ); - inTransaction( + scope.inTransaction( s -> s.persist( firstParty ) ); - assertInsertCount( 1 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.save( contract ) ); - assertInsertCount( 1 ); + assertInsertCount( 1, sessionFactory ); // BUG, should be assertUpdateCount( ! isContractPartiesInverse && isPartyVersioned ? 1 : 0 ); - assertUpdateCount( 0 ); - clearCounts(); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -202,24 +211,26 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testAddNewOneToManyElementToPersistentEntity() { - clearCounts(); + public void testAddNewOneToManyElementToPersistentEntity(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 1 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = s.get( Contract.class, contract.getId() ); assertEquals( 0, c.getParties().size() ); @@ -227,11 +238,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 1, c.getParties().size() ); @@ -245,28 +256,30 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testAddExistingOneToManyElementToPersistentEntity() { - clearCounts(); + public void testAddExistingOneToManyElementToPersistentEntity(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); - inTransaction( + scope.inTransaction( s -> { s.persist( contract ); s.persist( firstParty ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = s.get( Contract.class, contract.getId() ); assertEquals( 0, c.getParties().size() ); @@ -278,13 +291,13 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 0 ); + assertInsertCount( 0 , sessionFactory); if ( checkUpdateCountsAfterAddingExistingElement() ) { - assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 ); + assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0, sessionFactory ); } - clearCounts(); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -304,18 +317,20 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement() { - clearCounts(); + public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); - inTransaction( + scope.inTransaction( s -> { s.persist( contract ); s.persist( firstParty ); @@ -323,23 +338,23 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.update( contract ) ); - assertInsertCount( 0 ); + assertInsertCount( 0 , sessionFactory); if ( checkUpdateCountsAfterAddingExistingElement() ) { - assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 ); + assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 , sessionFactory); } - clearCounts(); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -359,38 +374,40 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyOneToManyCollectionUpdateWithNewElement() { - clearCounts(); + public void testCreateWithNonEmptyOneToManyCollectionUpdateWithNewElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); Party newParty = new Party( "new party" ); contract.addParty( newParty ); - inTransaction( + scope.inTransaction( s -> s.update( contract ) ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 2, c.getParties().size() ); @@ -414,41 +431,43 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3 , sessionFactory); } @Test - public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement() { - clearCounts(); + public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); - inTransaction( + scope.inTransaction( s -> { s.persist( contract ); s.persist( firstParty ); } ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.merge( contract ) ); - assertInsertCount( 0 ); + assertInsertCount( 0 , sessionFactory); if ( checkUpdateCountsAfterAddingExistingElement() ) { - assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 ); + assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0, sessionFactory ); } - clearCounts(); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -468,38 +487,40 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testCreateWithNonEmptyOneToManyCollectionMergeWithNewElement() { - clearCounts(); + public void testCreateWithNonEmptyOneToManyCollectionMergeWithNewElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); Party newParty = new Party( "new party" ); contract.addParty( newParty ); - inTransaction( + scope.inTransaction( s -> s.merge( contract ) ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 2, c.getParties().size() ); @@ -520,28 +541,30 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3 , sessionFactory); } @Test - public void testMoveOneToManyElementToNewEntityCollection() { - clearCounts(); + public void testMoveOneToManyElementToNewEntityCollection(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); contract.addParty( new Party( "party" ) ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); Contract contract2 = new Contract( null, "david", "phone" ); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 1, c.getParties().size() ); @@ -556,11 +579,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContractById( s, contract.getId() ); Contract c2 = getContractById( s, contract2.getId() ); @@ -589,30 +612,32 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3 , sessionFactory); } @Test - public void testMoveOneToManyElementToExistingEntityCollection() { - clearCounts(); + public void testMoveOneToManyElementToExistingEntityCollection(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); contract.addParty( new Party( "party" ) ); Contract contract2 = new Contract( null, "david", "phone" ); - inTransaction( + scope.inTransaction( s -> { s.persist( contract ); s.persist( contract2 ); } ); - assertInsertCount( 3 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 3, sessionFactory ); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContractById( s, contract.getId() ); assertEquals( 1, c.getParties().size() ); @@ -627,11 +652,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 0 ); - assertUpdateCount( isContractVersioned ? 2 : 0 ); - clearCounts(); + assertInsertCount( 0 , sessionFactory); + assertUpdateCount( isContractVersioned ? 2 : 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContractById( s, contract.getId() ); Contract c2 = getContractById( s, contract2.getId() ); @@ -660,25 +685,27 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3 , sessionFactory); } @Test - public void testRemoveOneToManyElementUsingUpdate() { - clearCounts(); + public void testRemoveOneToManyElementUsingUpdate(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.removeParty( firstParty ); assertEquals( 0, contract.getParties().size() ); @@ -686,7 +713,7 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional assertNull( firstParty.getContract() ); } - inTransaction( + scope.inTransaction( s -> { s.update( contract ); s.update( firstParty ); @@ -694,12 +721,12 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional ); if ( checkUpdateCountsAfterRemovingElementWithoutDelete() ) { - assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 ); + assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0, sessionFactory ); } - assertDeleteCount( 0 ); - clearCounts(); + assertDeleteCount( 0 , sessionFactory); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -722,25 +749,27 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testRemoveOneToManyElementUsingMerge() { - clearCounts(); + public void testRemoveOneToManyElementUsingMerge(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.removeParty( firstParty ); assertEquals( 0, contract.getParties().size() ); @@ -748,7 +777,7 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional assertNull( firstParty.getContract() ); } - inTransaction( + scope.inTransaction( s -> { s.merge( contract ); s.merge( firstParty ); @@ -757,12 +786,12 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional if ( checkUpdateCountsAfterRemovingElementWithoutDelete() ) { - assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0 ); + assertUpdateCount( isContractVersioned && !isContractPartiesInverse ? 1 : 0, sessionFactory ); } - assertDeleteCount( 0 ); - clearCounts(); + assertDeleteCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); if ( isContractPartiesInverse ) { @@ -785,27 +814,29 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional ); - assertUpdateCount( 0 ); - assertDeleteCount( 2 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 2, sessionFactory ); } @Test - public void testDeleteOneToManyElement() { - clearCounts(); + public void testDeleteOneToManyElement(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { s.update( contract ); contract.removeParty( firstParty ); @@ -813,11 +844,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + assertDeleteCount( 1, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 0, c.getParties().size() ); @@ -828,25 +859,27 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testRemoveOneToManyElementByDelete() { - clearCounts(); + public void testRemoveOneToManyElementByDelete(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); Party firstParty = new Party( "party" ); contract.addParty( firstParty ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.removeParty( firstParty ); assertEquals( 0, contract.getParties().size() ); @@ -854,18 +887,18 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional assertNull( firstParty.getContract() ); } - inTransaction( + scope.inTransaction( s -> { s.update( contract ); s.delete( firstParty ); } ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + assertDeleteCount( 1, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 0, c.getParties().size() ); @@ -874,25 +907,27 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testRemoveOneToManyOrphanUsingUpdate() { - clearCounts(); + public void testRemoveOneToManyOrphanUsingUpdate(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); ContractVariation contractV = new ContractVariation( 1, contract ); contractV.setText( "cv1" ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.getVariations().remove( contractV ); contractV.setContract( null ); @@ -901,15 +936,15 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional assertNull( contractV.getContract() ); } - inTransaction( + scope.inTransaction( s -> s.update( contract ) ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + assertDeleteCount( 1, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 0, c.getVariations().size() ); @@ -921,22 +956,24 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testRemoveOneToManyOrphanUsingMerge() { + public void testRemoveOneToManyOrphanUsingMerge(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); ContractVariation contractVariation = new ContractVariation( 1, contract ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); contract.getVariations().remove( contractVariation ); contractVariation.setContract( null ); @@ -945,18 +982,18 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional assertNull( contractVariation.getContract() ); } - inTransaction( + scope.inTransaction( s -> { s.merge( contract ); s.merge( contractVariation ); } ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + assertDeleteCount( 1, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 0, c.getVariations().size() ); @@ -967,26 +1004,28 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testDeleteOneToManyOrphan() { - clearCounts(); + public void testDeleteOneToManyOrphan(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract contract = new Contract( null, "gail", "phone" ); ContractVariation contractVariation = new ContractVariation( 1, contract ); - inTransaction( + scope.inTransaction( s -> s.persist( contract ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { s.update( contract ); contract.getVariations().remove( contractVariation ); @@ -996,11 +1035,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - assertDeleteCount( 1 ); - clearCounts(); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + assertDeleteCount( 1, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); assertEquals( 0, c.getVariations().size() ); @@ -1011,27 +1050,29 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 1 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 1, sessionFactory ); } @Test - public void testOneToManyCollectionOptimisticLockingWithMerge() { - clearCounts(); + public void testOneToManyCollectionOptimisticLockingWithMerge(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract cOrig = new Contract( null, "gail", "phone" ); Party partyOrig = new Party( "party" ); cOrig.addParty( partyOrig ); - inTransaction( + scope.inTransaction( s -> s.persist( cOrig ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = s.get( Contract.class, cOrig.getId() ); Party newParty = new Party( "new party" ); @@ -1039,11 +1080,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inSession( + scope.inSession( s -> { cOrig.removeParty( partyOrig ); try { @@ -1061,7 +1102,7 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional ); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); s.delete( c ); @@ -1070,26 +1111,28 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertUpdateCount( 0 ); - assertDeleteCount( 3 ); + assertUpdateCount( 0, sessionFactory ); + assertDeleteCount( 3 , sessionFactory); } @Test - public void testOneToManyCollectionOptimisticLockingWithUpdate() { - clearCounts(); + public void testOneToManyCollectionOptimisticLockingWithUpdate(SessionFactoryScope scope) { + SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); + + clearCounts(sessionFactory); Contract cOrig = new Contract( null, "gail", "phone" ); Party partyOrig = new Party( "party" ); cOrig.addParty( partyOrig ); - inTransaction( + scope.inTransaction( s -> s.persist( cOrig ) ); - assertInsertCount( 2 ); - assertUpdateCount( 0 ); - clearCounts(); + assertInsertCount( 2 , sessionFactory); + assertUpdateCount( 0, sessionFactory ); + clearCounts(sessionFactory); - inTransaction( + scope.inTransaction( s -> { Contract c = s.get( Contract.class, cOrig.getId() ); Party newParty = new Party( "new party" ); @@ -1097,11 +1140,11 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - assertInsertCount( 1 ); - assertUpdateCount( isContractVersioned ? 1 : 0 ); - clearCounts(); + assertInsertCount( 1, sessionFactory ); + assertUpdateCount( isContractVersioned ? 1 : 0 , sessionFactory); + clearCounts(sessionFactory); - inSession( + scope.inSession( s -> { s.beginTransaction(); cOrig.removeParty( partyOrig ); @@ -1113,7 +1156,7 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional catch (PersistenceException ex) { s.getTransaction().rollback(); assertTrue( isContractVersioned ); - if ( !sessionFactory().getSessionFactoryOptions().isJdbcBatchVersionedData() ) { + if ( !sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData() ) { assertTyping( StaleObjectStateException.class, ex.getCause() ); } else { @@ -1123,7 +1166,7 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional } ); - inTransaction( + scope.inTransaction( s -> { Contract c = getContract( s ); s.createQuery( "delete from Party" ).executeUpdate(); @@ -1183,22 +1226,22 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional return s.createQuery( rowCountCriteria ).uniqueResult(); } - protected void clearCounts() { - sessionFactory().getStatistics().clear(); + protected void clearCounts(SessionFactoryImplementor sessionFactory) { + sessionFactory.getStatistics().clear(); } - protected void assertInsertCount(int expected) { - int inserts = (int) sessionFactory().getStatistics().getEntityInsertCount(); - assertEquals( "unexpected insert count", expected, inserts ); + protected void assertInsertCount(int expected, SessionFactoryImplementor sessionFactory) { + int inserts = (int) sessionFactory.getStatistics().getEntityInsertCount(); + assertEquals( expected, inserts, "unexpected insert count" ); } - protected void assertUpdateCount(int expected) { - int updates = (int) sessionFactory().getStatistics().getEntityUpdateCount(); - assertEquals( "unexpected update counts", expected, updates ); + protected void assertUpdateCount(int expected, SessionFactoryImplementor sessionFactory) { + int updates = (int) sessionFactory.getStatistics().getEntityUpdateCount(); + assertEquals( expected, updates, "unexpected update counts" ); } - protected void assertDeleteCount(int expected) { - int deletes = (int) sessionFactory().getStatistics().getEntityDeleteCount(); - assertEquals( "unexpected delete counts", expected, deletes ); + protected void assertDeleteCount(int expected, SessionFactoryImplementor sessionFactory) { + int deletes = (int) sessionFactory.getStatistics().getEntityDeleteCount(); + assertEquals( expected, deletes, "unexpected delete counts" ); } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Contract.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Contract.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Contract.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Contract.java index 747d16fb5c..ed527ec336 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Contract.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Contract.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/ContractVariation.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/ContractVariation.java similarity index 93% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/ContractVariation.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/ContractVariation.java index 06b7941bbd..c102eb63fe 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/ContractVariation.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/ContractVariation.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; import java.util.HashSet; import java.util.Set; diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Info.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Info.java similarity index 91% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Info.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Info.java index 36d0405b99..1fb888eb19 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Info.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Info.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; public class Info implements Serializable { diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Owner.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Owner.java similarity index 92% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Owner.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Owner.java index 48673c2265..f731132789 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Owner.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Owner.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; public class Owner implements Serializable { diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Party.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Party.java similarity index 94% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Party.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Party.java index 1db4616146..708f8fff6d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Party.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Party.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; import java.util.HashSet; import java.util.Set; diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Plan.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Plan.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Plan.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Plan.java index cc8db85ee3..78c913fdc2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/Plan.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/Plan.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection; +package org.hibernate.orm.test.immutable.entitywithmutablecollection; import java.io.Serializable; import java.util.HashSet; import java.util.Iterator; diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml index 3dcddb3565..33af473b6d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml index b096487518..8779aad9dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml index dc89b01b13..90db0e8ef5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml index 5dd98d231d..554f4d2724 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java new file mode 100644 index 0000000000..c2a21345be --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml" +) +public class EntityWithInverseManyToManyTest extends AbstractEntityWithManyToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java new file mode 100644 index 0000000000..108af7f11b --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java @@ -0,0 +1,27 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.dialect.CUBRIDDialect; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SkipForDialect; + +/** + * @author Gail Badner + */ +@SkipForDialect( + dialectClass = CUBRIDDialect.class, + reason = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" +) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml" +) +public class EntityWithInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java new file mode 100644 index 0000000000..9627f1bca8 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml" +) +public class EntityWithInverseOneToManyTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java new file mode 100644 index 0000000000..bdf293457e --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" +) +public class VersionedEntityWithInverseManyToManyTest extends AbstractEntityWithManyToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java new file mode 100644 index 0000000000..155809641d --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java @@ -0,0 +1,78 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Test; + +/** + * @author Gail Badner + *

+ * These tests reproduce HHH-4992. + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" +) +public class VersionedEntityWithInverseOneToManyFailureExpectedTest extends AbstractEntityWithOneToManyTest { + public String[] getMappings() { + return new String[] {}; + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with versioned entity with inverse collection" + ) + public void testAddExistingOneToManyElementToPersistentEntity(SessionFactoryScope scope) { + super.testAddExistingOneToManyElementToPersistentEntity( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with versioned entity with inverse collection" + ) + public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement(SessionFactoryScope scope) { + super.testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with versioned entity with inverse collection" + ) + public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement(SessionFactoryScope scope) { + super.testCreateWithEmptyOneToManyCollectionMergeWithExistingElement( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with versioned entity with inverse collection" + ) + public void testRemoveOneToManyElementUsingUpdate(SessionFactoryScope scope) { + super.testRemoveOneToManyElementUsingUpdate( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with versioned entity with inverse collection" + ) + public void testRemoveOneToManyElementUsingMerge(SessionFactoryScope scope) { + super.testRemoveOneToManyElementUsingMerge( scope ); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java new file mode 100644 index 0000000000..d4ed762c89 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java @@ -0,0 +1,80 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.dialect.CUBRIDDialect; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.FailureExpected; +import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.hibernate.testing.orm.junit.SkipForDialect; +import org.junit.jupiter.api.Test; + +/** + * @author Gail Badner + */ +@SkipForDialect( + dialectClass = CUBRIDDialect.class, + reason = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" +) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" +) +public class VersionedEntityWithInverseOneToManyJoinFailureExpectedTest extends AbstractEntityWithOneToManyTest { + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with inverse collection" + ) + public void testAddExistingOneToManyElementToPersistentEntity(SessionFactoryScope scope) { + super.testAddExistingOneToManyElementToPersistentEntity( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with inverse collection" + ) + public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement(SessionFactoryScope scope) { + super.testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with inverse collection" + ) + public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement(SessionFactoryScope scope) { + super.testCreateWithEmptyOneToManyCollectionMergeWithExistingElement( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with inverse collection" + ) + public void testRemoveOneToManyElementUsingUpdate(SessionFactoryScope scope) { + super.testRemoveOneToManyElementUsingUpdate( scope ); + } + + @Test + @Override + @FailureExpected( + jiraKey = "HHH-4992", + reason = "known to fail with inverse collection" + ) + public void testRemoveOneToManyElementUsingMerge(SessionFactoryScope scope) { + super.testRemoveOneToManyElementUsingMerge( scope ); + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java new file mode 100644 index 0000000000..3c4f551194 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java @@ -0,0 +1,40 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; + +import org.hibernate.dialect.CUBRIDDialect; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SkipForDialect; + + +/** + * @author Gail Badner + */ +@TestForIssue(jiraKey = "HHH-4992") +@SkipForDialect( + dialectClass = CUBRIDDialect.class, + reason = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" +) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" +) +public class VersionedEntityWithInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { + + @Override + protected boolean checkUpdateCountsAfterAddingExistingElement() { + return false; + } + + @Override + protected boolean checkUpdateCountsAfterRemovingElementWithoutDelete() { + return false; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java similarity index 58% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java index f43a3b35d2..59eeb7758f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyTest.java @@ -4,22 +4,26 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; +package org.hibernate.orm.test.immutable.entitywithmutablecollection.inverse; -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; /** * @author Gail Badner */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" +) public class VersionedEntityWithInverseOneToManyTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" }; - } + @Override protected boolean checkUpdateCountsAfterAddingExistingElement() { return false; } + @Override protected boolean checkUpdateCountsAfterRemovingElementWithoutDelete() { return false; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml index 63d3b85984..a82a4126dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml index 64633b9762..b935922d7d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml index 097fd1a3f3..7dc9c9ec2f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml index 9003330fc5..fa6cd7fd34 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml rename to hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml index ee5f8e4653..5c2c9f1936 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml @@ -15,7 +15,7 @@ --> - + diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java new file mode 100644 index 0000000000..ca6d7eca86 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml" +) +public class EntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java new file mode 100644 index 0000000000..5f3bfdde0d --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml" +) +public class EntityWithNonInverseManyToManyUnidirTest extends AbstractEntityWithManyToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java new file mode 100644 index 0000000000..d9a19abb0b --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java @@ -0,0 +1,27 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.dialect.CUBRIDDialect; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SkipForDialect; + +/** + * @author Gail Badner + */ +@SkipForDialect( + dialectClass = CUBRIDDialect.class, + reason = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" +) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml" +) +public class EntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java new file mode 100644 index 0000000000..b2023655ba --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml" +) +public class EntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java new file mode 100644 index 0000000000..eec3f3d395 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml" +) +public class EntityWithNonInverseOneToManyUnidirTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java new file mode 100644 index 0000000000..6d7cb40943 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml" +) +public class VersionedEntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java new file mode 100644 index 0000000000..9b05567b87 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java @@ -0,0 +1,27 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.dialect.CUBRIDDialect; +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SkipForDialect; + +/** + * @author Gail Badner + */ +@SkipForDialect( + dialectClass = CUBRIDDialect.class, + reason = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + + "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" +) +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml" +) +public class VersionedEntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java new file mode 100644 index 0000000000..901d16f0e5 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java @@ -0,0 +1,20 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.immutable.entitywithmutablecollection.noninverse; + +import org.hibernate.orm.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; + +import org.hibernate.testing.orm.junit.DomainModel; + +/** + * @author Gail Badner + */ +@DomainModel( + xmlMappings = "org/hibernate/orm/test/immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml" +) +public class VersionedEntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest { +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java deleted file mode 100644 index 56948bdfff..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseManyToManyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithInverseManyToManyTest extends AbstractEntityWithManyToManyTest { - @Override - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java deleted file mode 100644 index 04cdf53167..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyJoinTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.dialect.CUBRIDDialect; -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.SkipForDialect; - -/** - * @author Gail Badner - */ -@SkipForDialect( - value = CUBRIDDialect.class, - comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + - "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" -) -public class EntityWithInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationOneToManyJoin.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java deleted file mode 100644 index c710392d77..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/EntityWithInverseOneToManyTest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithInverseOneToManyTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariation.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java deleted file mode 100644 index f6117ad889..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseManyToManyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; - -/** - * @author Gail Badner - */ -public class VersionedEntityWithInverseManyToManyTest extends AbstractEntityWithManyToManyTest { - @Override - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java deleted file mode 100644 index 4a090238e4..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyFailureExpectedTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.junit.Test; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.FailureExpected; - -/** - * @author Gail Badner - * - * These tests reproduce HHH-4992. - */ -public class VersionedEntityWithInverseOneToManyFailureExpectedTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersioned.hbm.xml" }; - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with versioned entity with inverse collection" - ) - public void testAddExistingOneToManyElementToPersistentEntity() { - super.testAddExistingOneToManyElementToPersistentEntity(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with versioned entity with inverse collection" - ) - public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement() { - super.testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with versioned entity with inverse collection" - ) - public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement() { - super.testCreateWithEmptyOneToManyCollectionMergeWithExistingElement(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with versioned entity with inverse collection" - ) - public void testRemoveOneToManyElementUsingUpdate() { - super.testRemoveOneToManyElementUsingUpdate(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with versioned entity with inverse collection" - ) - public void testRemoveOneToManyElementUsingMerge() { - super.testRemoveOneToManyElementUsingMerge(); - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java deleted file mode 100644 index 55b6431ab2..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinFailureExpectedTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.dialect.CUBRIDDialect; -import org.hibernate.testing.SkipForDialect; -import org.junit.Test; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.FailureExpected; - -/** - * @author Gail Badner - */ -@SkipForDialect( - value = CUBRIDDialect.class, - comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + - "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" -) -public class VersionedEntityWithInverseOneToManyJoinFailureExpectedTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" }; - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with inverse collection" - ) - public void testAddExistingOneToManyElementToPersistentEntity() { - super.testAddExistingOneToManyElementToPersistentEntity(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with inverse collection" - ) - public void testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement() { - super.testCreateWithEmptyOneToManyCollectionUpdateWithExistingElement(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with inverse collection" - ) - public void testCreateWithEmptyOneToManyCollectionMergeWithExistingElement() { - super.testCreateWithEmptyOneToManyCollectionMergeWithExistingElement(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with inverse collection" - ) - public void testRemoveOneToManyElementUsingUpdate() { - super.testRemoveOneToManyElementUsingUpdate(); - } - - @Test - @Override - @FailureExpected( - jiraKey = "HHH-4992", - message = "known to fail with inverse collection" - ) - public void testRemoveOneToManyElementUsingMerge() { - super.testRemoveOneToManyElementUsingMerge(); - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java deleted file mode 100644 index 24e81f2270..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/inverse/VersionedEntityWithInverseOneToManyJoinTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.inverse; - -import org.hibernate.dialect.CUBRIDDialect; -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.SkipForDialect; -import org.hibernate.testing.TestForIssue; - - -/** - * @author Gail Badner - */ -@TestForIssue( jiraKey = "HHH-4992" ) -@SkipForDialect( - value = CUBRIDDialect.class, - comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + - "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" -) -public class VersionedEntityWithInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/inverse/ContractVariationVersionedOneToManyJoin.hbm.xml" }; - } - - protected boolean checkUpdateCountsAfterAddingExistingElement() { - return false; - } - - protected boolean checkUpdateCountsAfterRemovingElementWithoutDelete() { - return false; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java deleted file mode 100644 index 2dd0ce19b1..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest { - @Override - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java deleted file mode 100644 index 4cae074e65..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseManyToManyUnidirTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithNonInverseManyToManyUnidirTest extends AbstractEntityWithManyToManyTest { - @Override - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java deleted file mode 100644 index f284a4c0a8..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyJoinTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.dialect.CUBRIDDialect; -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.SkipForDialect; - -/** - * @author Gail Badner - */ -@SkipForDialect( - value = CUBRIDDialect.class, - comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + - "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" -) -public class EntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationOneToManyJoin.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java deleted file mode 100644 index 138ae738c5..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyTest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariation.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java deleted file mode 100644 index aad8018218..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/EntityWithNonInverseOneToManyUnidirTest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; - -/** - * @author Gail Badner - */ -public class EntityWithNonInverseOneToManyUnidirTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationUnidir.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java deleted file mode 100644 index cedbe62dee..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseManyToManyTest.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithManyToManyTest; - -/** - * @author Gail Badner - */ -public class VersionedEntityWithNonInverseManyToManyTest extends AbstractEntityWithManyToManyTest { - @Override - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java deleted file mode 100644 index fb735d2aaa..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyJoinTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.dialect.CUBRIDDialect; -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; -import org.hibernate.testing.SkipForDialect; - -/** - * @author Gail Badner - */ -@SkipForDialect( - value = CUBRIDDialect.class, - comment = "As of verion 8.4.1 CUBRID doesn't support temporary tables. This test fails with" + - "HibernateException: cannot doAfterTransactionCompletion multi-table deletes using dialect not supporting temp tables" -) -public class VersionedEntityWithNonInverseOneToManyJoinTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersionedOneToManyJoin.hbm.xml" }; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java b/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java deleted file mode 100644 index a25d9eb02c..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/test/immutable/entitywithmutablecollection/noninverse/VersionedEntityWithNonInverseOneToManyTest.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.test.immutable.entitywithmutablecollection.noninverse; - -import org.hibernate.test.immutable.entitywithmutablecollection.AbstractEntityWithOneToManyTest; - -/** - * @author Gail Badner - */ -public class VersionedEntityWithNonInverseOneToManyTest extends AbstractEntityWithOneToManyTest { - public String[] getMappings() { - return new String[] { "immutable/entitywithmutablecollection/noninverse/ContractVariationVersioned.hbm.xml" }; - } -}