diff --git a/hibernate-core/src/test/java/org/hibernate/test/converter/AttributeConverterTest.java b/hibernate-core/src/test/java/org/hibernate/test/converter/AttributeConverterTest.java index f052d52cbe..a24ee446cd 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/converter/AttributeConverterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/converter/AttributeConverterTest.java @@ -29,8 +29,6 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.hql.internal.ast.tree.JavaConstantNode; import org.hibernate.internal.util.ConfigHelper; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; @@ -349,18 +347,11 @@ public class AttributeConverterTest extends BaseUnitTestCase { s = sf.openSession(); s.beginTransaction(); - entity = (EntityWithConvertibleField) s.load( EntityWithConvertibleField.class, entityID ); + entity = s.load( EntityWithConvertibleField.class, entityID ); assertEquals( ConvertibleEnum.VALUE, entity.getConvertibleEnum() ); s.getTransaction().commit(); s.close(); - JavaConstantNode javaConstantNode = new JavaConstantNode(); - javaConstantNode.setExpectedType( type ); - javaConstantNode.setSessionFactory( (SessionFactoryImplementor) sf ); - javaConstantNode.setText( "org.hibernate.test.converter.AttributeConverterTest$ConvertibleEnum.VALUE" ); - final String outcome = javaConstantNode.getRenderText( (SessionFactoryImplementor) sf ); - assertEquals( "'VALUE'", outcome ); - s = sf.openSession(); s.beginTransaction(); s.createQuery( "FROM EntityWithConvertibleField e where e.convertibleEnum = org.hibernate.test.converter.AttributeConverterTest$ConvertibleEnum.VALUE" ) diff --git a/hibernate-core/src/test/java/org/hibernate/test/inheritance/MappedSuperclassInheritanceTest.java b/hibernate-core/src/test/java/org/hibernate/test/inheritance/MappedSuperclassInheritanceTest.java index b0a81572f2..b771c45ade 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/inheritance/MappedSuperclassInheritanceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/inheritance/MappedSuperclassInheritanceTest.java @@ -14,9 +14,9 @@ import javax.persistence.InheritanceType; import javax.persistence.MappedSuperclass; import org.hibernate.cfg.AnnotationBinder; -import org.hibernate.hql.internal.ast.QuerySyntaxException; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.query.SemanticException; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.logger.LoggerInspectionRule; @@ -75,7 +75,7 @@ public class MappedSuperclassInheritanceTest extends BaseEntityManagerFunctional entityManager.createQuery("from Employee").getResultList(); fail(); } catch (Exception expected) { - QuerySyntaxException rootException = (QuerySyntaxException) ExceptionUtil.rootCause(expected); + SemanticException rootException = (SemanticException) ExceptionUtil.rootCause( expected); assertEquals("Employee is not mapped", rootException.getMessage()); } } ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/MultiInheritanceImplicitDowncastTest.java b/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/MultiInheritanceImplicitDowncastTest.java index c094e1651a..c707f72e1c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/MultiInheritanceImplicitDowncastTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/MultiInheritanceImplicitDowncastTest.java @@ -25,13 +25,11 @@ package org.hibernate.test.inheritance.discriminator; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; - import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverrides; import javax.persistence.Basic; @@ -52,14 +50,12 @@ import javax.persistence.MappedSuperclass; import javax.persistence.OneToMany; import javax.persistence.OrderColumn; -import org.hibernate.hql.spi.QueryTranslator; +import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; /** * @author Christian Beikov @@ -116,27 +112,28 @@ public class MultiInheritanceImplicitDowncastTest extends BaseCoreFunctionalTest } private void testMultiJoinAddition(String hql) { - final HQLQueryPlan plan = sessionFactory().getQueryInterpretationCache().getHQLQueryPlan( - hql, - false, - Collections.EMPTY_MAP - ); - assertEquals( 1, plan.getTranslators().length ); - final QueryTranslator translator = plan.getTranslators()[0]; - final String generatedSql = translator.getSQLString(); - - int sub1JoinColumnIndex = generatedSql.indexOf( ".base_sub_1" ); - assertNotEquals( - "Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub1' via 'base_sub_1':\n" + generatedSql, - -1, - sub1JoinColumnIndex - ); - int sub2JoinColumnIndex = generatedSql.indexOf( ".base_sub_2" ); - assertNotEquals( - "Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub2' via 'base_sub_2':\n" + generatedSql, - -1, - sub2JoinColumnIndex - ); + throw new NotYetImplementedFor6Exception( getClass() ); +// final HQLQueryPlan plan = sessionFactory().getQueryInterpretationCache().getHQLQueryPlan( +// hql, +// false, +// Collections.EMPTY_MAP +// ); +// assertEquals( 1, plan.getTranslators().length ); +// final QueryTranslator translator = plan.getTranslators()[0]; +// final String generatedSql = translator.getSQLString(); +// +// int sub1JoinColumnIndex = generatedSql.indexOf( ".base_sub_1" ); +// assertNotEquals( +// "Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub1' via 'base_sub_1':\n" + generatedSql, +// -1, +// sub1JoinColumnIndex +// ); +// int sub2JoinColumnIndex = generatedSql.indexOf( ".base_sub_2" ); +// assertNotEquals( +// "Generated SQL doesn't contain a join for 'base' with 'PolymorphicSub2' via 'base_sub_2':\n" + generatedSql, +// -1, +// sub2JoinColumnIndex +// ); } @MappedSuperclass diff --git a/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/joinedsubclass/JoinedSubclassTest.java b/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/joinedsubclass/JoinedSubclassTest.java index c0e9726cbe..40b83da966 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/joinedsubclass/JoinedSubclassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/inheritance/discriminator/joinedsubclass/JoinedSubclassTest.java @@ -6,8 +6,11 @@ */ package org.hibernate.test.inheritance.discriminator.joinedsubclass; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; + import org.hibernate.Transaction; -import org.hibernate.criterion.Restrictions; import org.hibernate.resource.transaction.spi.TransactionStatus; import org.junit.Before; @@ -84,9 +87,11 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase { public void shouldRetrieveSubSubEntityWithCriteria() { session = openSession(); try { - SubSubEntity loaded = (SubSubEntity) session.createCriteria( SubSubEntity.class ) - .add( Restrictions.idEq( subSubEntityId ) ) - .uniqueResult(); + final CriteriaBuilder criteriaBuilder = session.getSessionFactory().getCriteriaBuilder(); + final CriteriaQuery criteria = criteriaBuilder.createQuery( SubSubEntity.class ); + final Root root = criteria.from( SubSubEntity.class ); + criteria.where( criteriaBuilder.equal( root.get( SubSubEntity_.id ), subSubEntityId ) ); + final SubSubEntity loaded = session.createQuery( criteria ).uniqueResult(); assertNotNull( loaded ); } finally { @@ -98,9 +103,12 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase { public void shouldNotRetrieveSubSubSubEntityWithCriteria() { session = openSession(); try { - SubSubSubEntity loaded = (SubSubSubEntity) session.createCriteria( SubSubSubEntity.class ) - .add( Restrictions.idEq( subSubEntityId ) ) - .uniqueResult(); + final CriteriaBuilder criteriaBuilder = session.getSessionFactory().getCriteriaBuilder(); + final CriteriaQuery criteria = criteriaBuilder.createQuery( SubSubSubEntity.class ); + final Root root = criteria.from( SubSubSubEntity.class ); + + criteria.where( criteriaBuilder.equal( root.get( SubSubSubEntity_.id ), subSubEntityId ) ); + final SubSubEntity loaded = session.createQuery( criteria ).uniqueResult(); assertNull( loaded ); } finally { @@ -116,7 +124,7 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase { try { SubSubEntity loaded = (SubSubEntity) session.createQuery( "select se from SubSubEntity se where se.id = :id" ) - .setLong( "id", subSubEntityId ) + .setParameter( "id", subSubEntityId ) .uniqueResult(); assertNotNull( loaded ); } @@ -131,7 +139,7 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase { try { SubSubSubEntity loaded = (SubSubSubEntity) session.createQuery( "select se from SubSubSubEntity se where se.id = :id" ) - .setLong( "id", subSubEntityId ) + .setParameter( "id", subSubEntityId ) .uniqueResult(); assertNull( loaded ); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/naturalid/cid/CompositeIdAndNaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/naturalid/cid/CompositeIdAndNaturalIdTest.java index dfc29f90d8..b213da3f84 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/naturalid/cid/CompositeIdAndNaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/naturalid/cid/CompositeIdAndNaturalIdTest.java @@ -9,9 +9,8 @@ package org.hibernate.test.naturalid.cid; import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.criterion.Restrictions; - import org.hibernate.persister.entity.EntityPersister; + import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Test; @@ -72,10 +71,7 @@ public class CompositeIdAndNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( Account ) s.createCriteria( Account.class ) - .add( Restrictions.naturalId().set( "shortCode", "testAcct" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( Account.class ).load( "testAcct" ); assertNotNull( u ); s.getTransaction().commit(); s.close(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableEntityNaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableEntityNaturalIdTest.java index 973e0f52b4..f8b2e50cbe 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableEntityNaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableEntityNaturalIdTest.java @@ -6,21 +6,19 @@ */ package org.hibernate.test.naturalid.immutable; -import javax.persistence.PersistenceException; import java.lang.reflect.Field; +import javax.persistence.PersistenceException; -import org.junit.Test; - -import org.hibernate.FetchMode; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.criterion.Restrictions; import org.hibernate.persister.entity.EntityPersister; +import org.hibernate.tuple.entity.EntityMetamodel; + import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.hibernate.tuple.entity.EntityMetamodel; +import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; @@ -107,11 +105,9 @@ public class ImmutableEntityNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - p = (Parent) s.createCriteria(Parent.class) - .add( Restrictions.eq("name", "alex") ) - .setFetchMode("children", FetchMode.JOIN) - .setCacheable(true) - .uniqueResult(); + p = s.createQuery( "from Parent p join fetch p.children where p.name = 'alex'", Parent.class ) + .setCacheable( true ) + .uniqueResult(); t.commit(); s.close(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java index becd4f5efe..cfd493f885 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java @@ -8,17 +8,15 @@ package org.hibernate.test.naturalid.immutable; import javax.persistence.PersistenceException; -import org.junit.Test; - -import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.criterion.Restrictions; import org.hibernate.persister.entity.EntityPersister; + import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -112,10 +110,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); s.getTransaction().commit(); s.close(); @@ -135,17 +130,11 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //2: no stats since hbm.xml can't enable NaturalId caching @@ -172,10 +161,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); s.getTransaction().commit(); s.close(); @@ -188,11 +174,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); - assertNotNull( u ); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching @@ -203,10 +185,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNull( u ); s.getTransaction().commit(); s.close(); @@ -227,10 +206,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); @@ -241,10 +217,7 @@ public class ImmutableNaturalIdTest extends BaseCoreFunctionalTestCase { s.getTransaction().commit(); s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId().set( "userName", "steve" ) ) - .setCacheable( true ) - .uniqueResult(); + u = s.bySimpleNaturalId( User.class ).load( "steve" ); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching diff --git a/hibernate-core/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java b/hibernate-core/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java index 060ae6fb7e..3824c1f63b 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/naturalid/mutable/MutableNaturalIdTest.java @@ -8,19 +8,18 @@ package org.hibernate.test.naturalid.mutable; import java.lang.reflect.Field; -import org.junit.Test; - import org.hibernate.HibernateException; import org.hibernate.LockOptions; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; -import org.hibernate.criterion.Restrictions; import org.hibernate.persister.entity.EntityPersister; +import org.hibernate.tuple.entity.EntityMetamodel; + import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.hibernate.tuple.entity.EntityMetamodel; +import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -172,14 +171,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { Session s = openSession(); Transaction t = s.beginTransaction(); - Object nullUser = s.createCriteria(User.class) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ) - .setCacheable(true) - .uniqueResult(); - + Object nullUser = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNull(nullUser); t.commit(); @@ -203,13 +198,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - u = (User) s.createCriteria(User.class) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ) - .setCacheable(true) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNotNull(u); @@ -225,12 +217,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - u = (User) s.createCriteria(User.class) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ).setCacheable(true) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); s.delete(u); @@ -245,13 +235,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - nullUser = s.createCriteria(User.class) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ) - .setCacheable(true) - .uniqueResult(); + nullUser = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNull(nullUser); @@ -276,13 +263,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set( "name", "gavin" ) - .set( "org", "hb" ) - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNotNull( u ); t.commit(); s.close(); @@ -302,24 +286,18 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); t = s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNotNull(u); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "gavin") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "gavin" ) + .using( "org", "hb" ) + .load(); assertNotNull(u); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching @@ -347,13 +325,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "steve") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "steve" ) + .using( "org", "hb" ) + .load(); assertNotNull( u ); s.getTransaction().commit(); s.close(); @@ -366,13 +341,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "steve") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "steve" ) + .using( "org", "hb" ) + .load(); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching @@ -384,13 +356,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "steve") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "steve" ) + .using( "org", "hb" ) + .load(); assertNull( u ); s.getTransaction().commit(); s.close(); @@ -411,13 +380,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "steve") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "steve" ) + .using( "org", "hb" ) + .load(); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); @@ -430,13 +396,10 @@ public class MutableNaturalIdTest extends BaseCoreFunctionalTestCase { s = openSession(); s.beginTransaction(); - u = ( User ) s.createCriteria( User.class ) - .add( Restrictions.naturalId() - .set("name", "steve") - .set("org", "hb") - ) - .setCacheable( true ) - .uniqueResult(); + u = s.byNaturalId( User.class ) + .using( "name", "steve" ) + .using( "org", "hb" ) + .load(); assertNotNull( u ); assertEquals( 1, sessionFactory().getStatistics().getNaturalIdQueryExecutionCount() ); //0: incorrect stats since hbm.xml can't enable NaturalId caching assertEquals( 0, sessionFactory().getStatistics().getNaturalIdCacheHitCount() ); //1: no stats since hbm.xml can't enable NaturalId caching diff --git a/hibernate-core/src/test/java/org/hibernate/test/propertyref/cachedcollections/CachedPropertyRefCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/test/propertyref/cachedcollections/CachedPropertyRefCollectionTest.java index 2a57a3e1e3..7165b84eb0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/propertyref/cachedcollections/CachedPropertyRefCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/propertyref/cachedcollections/CachedPropertyRefCollectionTest.java @@ -6,14 +6,12 @@ */ package org.hibernate.test.propertyref.cachedcollections; -import org.junit.Test; - -import org.hibernate.FetchMode; import org.hibernate.Hibernate; import org.hibernate.Session; -import org.hibernate.criterion.Restrictions; + import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.junit.Test; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -44,7 +42,7 @@ public class CachedPropertyRefCollectionTest extends BaseCoreFunctionalTestCase // First attempt to load it via PK lookup session = openSession(); session.beginTransaction(); - ManagedObject obj = (ManagedObject) session.get( ManagedObject.class, 1L ); + ManagedObject obj = session.get( ManagedObject.class, 1L ); assertNotNull( obj ); assertTrue( Hibernate.isInitialized( obj ) ); obj.getMembers().size(); @@ -55,11 +53,7 @@ public class CachedPropertyRefCollectionTest extends BaseCoreFunctionalTestCase // Now try to access it via natural key session = openSession(); session.beginTransaction(); - Criteria criteria = session.createCriteria( ManagedObject.class ) - .add( Restrictions.naturalId().set( "name", "test" ) ) - .setCacheable( true ) - .setFetchMode( "members", FetchMode.JOIN ); - obj = (ManagedObject) criteria.uniqueResult(); + obj = session.bySimpleNaturalId( ManagedObject.class ).load( "test" ); assertNotNull( obj ); assertTrue( Hibernate.isInitialized( obj ) ); obj.getMembers().size(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/querycache/AbstractQueryCacheResultTransformerTest.java b/hibernate-core/src/test/java/org/hibernate/test/querycache/AbstractQueryCacheResultTransformerTest.java index b049b59b46..3ef6f701bb 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/querycache/AbstractQueryCacheResultTransformerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/querycache/AbstractQueryCacheResultTransformerTest.java @@ -12,6 +12,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Join; +import javax.persistence.criteria.JoinType; +import javax.persistence.criteria.Order; +import javax.persistence.criteria.Root; + import org.junit.Test; import org.hibernate.CacheMode; @@ -25,7 +32,10 @@ import org.hibernate.cfg.Environment; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.proxy.HibernateProxy; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; + +import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.transform.AliasToBeanConstructorResultTransformer; +import org.hibernate.transform.AliasToEntityMapResultTransformer; import org.hibernate.transform.ResultTransformer; import org.hibernate.transform.Transformers; import org.hibernate.type.StandardBasicTypes; @@ -65,11 +75,28 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } protected abstract class CriteriaExecutor extends QueryExecutor { - protected abstract Criteria getCriteria(Session s) throws Exception; + protected abstract JpaCriteriaQuery getCriteria(Session s) throws Exception; + + protected ResultTransformer getResultTransformer() { + return AliasToEntityMapResultTransformer.INSTANCE; + } + @Override protected Object getResults(Session s, boolean isSingleResult) throws Exception { - Criteria criteria = getCriteria( s ).setCacheable( getQueryCacheMode() != CacheMode.IGNORE ).setCacheMode( getQueryCacheMode() ); - return ( isSingleResult ? criteria.uniqueResult() : criteria.list() ); + final CacheMode cacheMode = getQueryCacheMode(); + + final JpaCriteriaQuery criteria = getCriteria( s ); + final Query query = s.createQuery( criteria ).setCacheMode( cacheMode ); + + if ( cacheMode != CacheMode.IGNORE ) { + query.setCacheable( true ); + } + + if ( getResultTransformer() != null ) { + query.setResultTransformer( getResultTransformer() ); + } + + return ( isSingleResult ? query.uniqueResult() : query.list() ); } } @@ -193,14 +220,20 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testAliasToEntityMapNoProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { @Override - protected Criteria getCriteria(Session s) { - return s.createCriteria( Student.class, "s" ) - .createAlias( "s.enrolments", "e", CriteriaSpecification.LEFT_JOIN ) - .createAlias( "e.course", "c", CriteriaSpecification.LEFT_JOIN ) - .setResultTransformer( CriteriaSpecification.ALIAS_TO_ENTITY_MAP ) - .addOrder( Order.asc( "s.studentNumber") ); + protected JpaCriteriaQuery getCriteria(Session s) { + final CriteriaBuilder builder = s.getSessionFactory().getCriteriaBuilder(); + + final JpaCriteriaQuery criteria = (JpaCriteriaQuery) builder.createQuery( Student.class ); + + final Root studentRoot = criteria.from( Student.class ); + studentRoot.join( "enrolments", JoinType.LEFT ).join( "course", JoinType.LEFT ); + + criteria.orderBy( builder.asc( studentRoot.get( "studentNumber" ) ) ); + + return criteria; } }; + HqlExecutor hqlExecutor = new HqlExecutor() { @Override public Query getQuery(Session s) { @@ -208,6 +241,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu .setResultTransformer( Transformers.ALIAS_TO_ENTITY_MAP ); } }; + ResultChecker checker = new ResultChecker() { public void check(Object results) { List resultList = ( List ) results; @@ -232,12 +266,18 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testAliasToEntityMapNoProjectionMultiAndNullList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { @Override - protected Criteria getCriteria(Session s) { - return s.createCriteria( Student.class, "s" ) - .createAlias( "s.preferredCourse", "p", CriteriaSpecification.LEFT_JOIN ) - .createAlias( "s.addresses", "a", CriteriaSpecification.LEFT_JOIN ) - .setResultTransformer( CriteriaSpecification.ALIAS_TO_ENTITY_MAP ) - .addOrder( Order.asc( "s.studentNumber" ) ); + protected JpaCriteriaQuery getCriteria(Session s) { + final CriteriaBuilder builder = s.getSessionFactory().getCriteriaBuilder(); + + final JpaCriteriaQuery criteria = (JpaCriteriaQuery) builder.createQuery( Student.class ); + + final Root studentRoot = criteria.from( Student.class ); + studentRoot.join( "preferredCourse", JoinType.LEFT ); + studentRoot.join( "addresses", JoinType.LEFT ); + + criteria.orderBy( builder.asc( studentRoot.get( "studentNumber" ) ) ); + + return criteria; } }; HqlExecutor hqlExecutor = new HqlExecutor() { @@ -282,7 +322,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testAliasToEntityMapNoProjectionNullAndNonNullAliasList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { @Override - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.addresses", "a", CriteriaSpecification.LEFT_JOIN ) .setResultTransformer( CriteriaSpecification.ALIAS_TO_ENTITY_MAP ) @@ -323,7 +363,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithNonLazyOneToManyUnique() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Course.class ); } @@ -347,7 +387,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithNonLazyManyToOneList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( CourseMeeting.class ) .addOrder( Order.asc( "id.day" ) ); @@ -376,7 +416,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithLazyAssnUnique() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .add( Restrictions.eq( "studentNumber", shermanExpected.getStudentNumber() ) ); @@ -403,7 +443,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithLazyAssnList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class ) .addOrder( Order.asc( "studentNumber" ) ); @@ -437,7 +477,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testEntityWithUnaliasedJoinFetchedLazyOneToManySingleElementList() throws Exception { // unaliased CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .setFetchMode( "enrolments", FetchMode.JOIN ) @@ -473,7 +513,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testJoinWithFetchJoinListCriteria() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pc", Criteria.LEFT_JOIN ) .setFetchMode( "enrolments", FetchMode.JOIN ) @@ -689,7 +729,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithSelectFetchedLazyOneToManySingleElementListCriteria() throws Exception { CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .setFetchMode( "enrolments", FetchMode.SELECT ) @@ -716,7 +756,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testEntityWithJoinFetchedLazyOneToManyMultiAndNullElementList() throws Exception { //unaliased CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .setFetchMode( "addresses", FetchMode.JOIN ) @@ -731,7 +771,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu //aliased CriteriaExecutor criteriaExecutorAliased1 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -740,7 +780,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased2 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -749,7 +789,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased3 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -758,7 +798,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased4 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -800,7 +840,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testEntityWithJoinFetchedLazyManyToOneList() throws Exception { // unaliased CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .setFetchMode( "preferredCourse", FetchMode.JOIN ) @@ -815,7 +855,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu // aliased CriteriaExecutor criteriaExecutorAliased1 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pCourse", Criteria.LEFT_JOIN ) @@ -824,7 +864,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased2 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pCourse", Criteria.LEFT_JOIN ) @@ -833,7 +873,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased3 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.preferredCourse", "pCourse", Criteria.LEFT_JOIN ) @@ -842,7 +882,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased4 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.preferredCourse", "pCourse", Criteria.LEFT_JOIN ) @@ -878,7 +918,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testEntityWithJoinFetchedLazyManyToOneUsingProjectionList() throws Exception { // unaliased CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "s", Criteria.LEFT_JOIN ) @@ -927,7 +967,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithJoinedLazyOneToManySingleElementListCriteria() throws Exception { CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.enrolments", Criteria.LEFT_JOIN ) @@ -935,7 +975,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased1 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.enrolments", "e", Criteria.LEFT_JOIN ) @@ -943,7 +983,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased2 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.enrolments", "e", Criteria.LEFT_JOIN ) @@ -974,7 +1014,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithJoinedLazyOneToManyMultiAndNullListCriteria() throws Exception { CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.addresses", Criteria.LEFT_JOIN ) @@ -982,7 +1022,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased1 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -990,7 +1030,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased2 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.addresses", "a", Criteria.LEFT_JOIN ) @@ -1022,7 +1062,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testEntityWithJoinedLazyManyToOneListCriteria() throws Exception { CriteriaExecutor criteriaExecutorUnaliased = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.preferredCourse", Criteria.LEFT_JOIN ) @@ -1030,7 +1070,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased1 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createCriteria( "s.preferredCourse", "p", Criteria.LEFT_JOIN ) @@ -1038,7 +1078,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu } }; CriteriaExecutor criteriaExecutorAliased2 = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "p", Criteria.LEFT_JOIN ) @@ -1159,7 +1199,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToEntityMapOneProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.property( "e.student" ).as( "student" ) ) .addOrder( Order.asc( "e.studentNumber") ) @@ -1195,7 +1235,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToEntityMapMultiProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.projectionList() @@ -1243,7 +1283,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToEntityMapMultiProjectionWithNullAliasList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.projectionList() @@ -1288,7 +1328,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToEntityMapMultiAggregatedPropProjectionSingleResult() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class ) .setProjection( Projections.projectionList() @@ -1320,7 +1360,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testOneNonEntityProjectionUnique() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.property( "e.semester" ) ) @@ -1345,7 +1385,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testOneNonEntityProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.property( "e.semester" ) ) @@ -1401,7 +1441,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testOneEntityProjectionUnique() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class ) .setProjection( Projections.property( "student" ) ) @@ -1430,7 +1470,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu public void testOneEntityProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { // should use PassThroughTransformer by default - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .setProjection( Projections.property( "e.student" ) ) .addOrder( Order.asc( "e.studentNumber") ); @@ -1458,7 +1498,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiEntityProjectionUnique() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class ) .setProjection( @@ -1500,7 +1540,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiEntityProjectionList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class, "e" ) .setProjection( @@ -1545,7 +1585,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiEntityProjectionAliasedList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { // should use PassThroughTransformer by default return s.createCriteria( Enrolment.class, "e" ) .setProjection( @@ -1590,7 +1630,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testSingleAggregatedPropProjectionSingleResult() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class ) .setProjection( Projections.min( "studentNumber" ) ); } @@ -1612,7 +1652,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiAggregatedPropProjectionSingleResult() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class ) .setProjection( Projections.projectionList() @@ -1641,7 +1681,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToBeanDtoOneArgList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "st" ) .createAlias( "e.course", "co" ) @@ -1674,7 +1714,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToBeanDtoMultiArgList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "st" ) .createAlias( "e.course", "co" ) @@ -1711,7 +1751,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiProjectionListThenApplyAliasToBean() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "st" ) .createAlias( "e.course", "co" ) @@ -1755,7 +1795,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToBeanDtoLiteralArgList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "st" ) .createAlias( "e.course", "co" ) @@ -1797,7 +1837,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testAliasToBeanDtoWithNullAliasList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Enrolment.class, "e" ) .createAlias( "e.student", "st" ) .createAlias( "e.course", "co" ) @@ -1835,7 +1875,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testOneSelectNewNoAliasesList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) throws Exception { + protected JpaCriteriaQuery getCriteria(Session s) throws Exception { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.property( "s.name" ) ) .addOrder( Order.asc( "s.studentNumber" ) ) @@ -1868,7 +1908,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testOneSelectNewAliasesList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) throws Exception { + protected JpaCriteriaQuery getCriteria(Session s) throws Exception { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.property( "s.name" ).as( "name" )) .addOrder( Order.asc( "s.studentNumber" ) ) @@ -1901,7 +1941,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectNewList() throws Exception{ CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) throws Exception { + protected JpaCriteriaQuery getCriteria(Session s) throws Exception { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -1938,7 +1978,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectNewWithLiteralList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) throws Exception { + protected JpaCriteriaQuery getCriteria(Session s) throws Exception { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -1976,7 +2016,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectNewListList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -2010,7 +2050,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectNewMapUsingAliasesList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -2044,7 +2084,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectNewMapUsingAliasesWithFetchJoinList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pc", Criteria.LEFT_JOIN ) .setFetchMode( "enrolments", FetchMode.JOIN ) @@ -2081,7 +2121,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMultiSelectAliasToEntityMapUsingAliasesWithFetchJoinList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pc", Criteria.LEFT_JOIN ) .setFetchMode( "enrolments", FetchMode.JOIN ) @@ -2149,7 +2189,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testSelectNewMapUsingAliasesList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -2183,7 +2223,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testSelectNewEntityConstructorList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .setProjection( Projections.projectionList() @@ -2224,7 +2264,7 @@ public abstract class AbstractQueryCacheResultTransformerTest extends BaseCoreFu @Test public void testMapKeyList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { - protected Criteria getCriteria(Session s) { + protected JpaCriteriaQuery getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.addresses", "a" ) .setProjection( Projections.property( "a.addressType" ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/sql/function/JpaFunctionTest.java b/hibernate-core/src/test/java/org/hibernate/test/sql/function/JpaFunctionTest.java index ee508a4d5d..1325945dc9 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/sql/function/JpaFunctionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/sql/function/JpaFunctionTest.java @@ -12,15 +12,13 @@ import javax.persistence.Entity; import javax.persistence.Id; import org.hibernate.dialect.H2Dialect; -import org.hibernate.hql.internal.ast.QuerySyntaxException; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; +import org.hibernate.query.SemanticException; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; import org.junit.Test; -import org.jboss.logging.Logger; - import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -78,7 +76,7 @@ public class JpaFunctionTest extends BaseEntityManagerFunctionalTestCase { } ); } catch ( Exception e ) { - assertEquals( QuerySyntaxException.class, e.getCause().getClass() ); + assertEquals( SemanticException.class, e.getCause().getClass() ); } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java index 5086e98ea3..28faa71e18 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java @@ -7,7 +7,6 @@ package org.hibernate.test.tm; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import javax.transaction.Transaction; @@ -17,7 +16,6 @@ import org.hibernate.EntityMode; import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.cfg.AvailableSettings; -import org.hibernate.criterion.Order; import org.hibernate.dialect.SQLServerDialect; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl; @@ -33,7 +31,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; /** * @author Gavin King @@ -109,14 +106,14 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); s1 = openSession(); - s1.createCriteria( "Item" ).list(); + s1.createQuery( "from Item" ).list(); //foo.put("description", "a big red foo"); //s1.flush(); tx = TestingJtaPlatformImpl.INSTANCE.getTransactionManager().suspend(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); s2 = openSession(); - s2.createCriteria( "Item" ).list(); + s2.createQuery( "from Item" ).list(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().resume( tx ); @@ -124,7 +121,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); s2 = openSession(); - s2.createCriteria( "Item" ).list(); + s2.createQuery( "from Item" ).list(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); assertEquals( 7, sessionFactory().getStatistics().getEntityLoadCount() ); @@ -171,15 +168,13 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s1 = openSession(); - List r1 = s1.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r1 = s1.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r1.size(), 2 ); Transaction tx1 = TestingJtaPlatformImpl.INSTANCE.getTransactionManager().suspend(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s2 = openSession(); - List r2 = s2.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r2 = s2.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r2.size(), 2 ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); @@ -199,8 +194,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s3 = openSession(); - s3.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + s3.createQuery( "from Item order by description" ).setCacheable( true ).list(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); assertEquals( sessionFactory().getStatistics().getSecondLevelCacheHitCount(), 4 ); @@ -216,8 +210,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { assertEquals( sessionFactory().getStatistics().getUpdateTimestampsCacheMissCount(), 0 ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().resume( tx4 ); - List r4 = s4.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r4 = s4.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r4.size(), 2 ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); @@ -272,8 +265,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { // open a new TX and execute a query, this would fill the query cache. TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s1 = openSession(); - List r1 = s1.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r1 = s1.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r1.size(), 2 ); foo = ( Map ) r1.get( 0 ); // update data and make query cache stale, but TX is suspended @@ -285,8 +277,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { // this TX is committed after query TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s2 = openSession(); - List r2 = s2.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r2 = s2.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r2.size(), 2 ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); @@ -321,8 +312,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); Session s3 = openSession(); - s3.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + s3.createQuery( "from Item order by description" ).setCacheable( true ).list(); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); assertEquals( 0, sessionFactory().getStatistics().getSecondLevelCacheHitCount() ); @@ -337,8 +327,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { assertEquals( 2, sessionFactory().getStatistics().getUpdateTimestampsCacheHitCount() ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().resume( tx4 ); - List r4 = s4.createCriteria( "Item" ).addOrder( Order.asc( "description" ) ) - .setCacheable( true ).list(); + List r4 = s4.createQuery( "from Item order by description" ).setCacheable( true ).list(); assertEquals( r4.size(), 2 ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); @@ -422,53 +411,6 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { // i verified that is does currently in my debugger... } - @Test - public void testCurrentSessionWithIterate() throws Exception { - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); - Session s = openSession(); - Map item1 = new HashMap(); - item1.put( "name", "Item - 1" ); - item1.put( "description", "The first item" ); - s.persist( "Item", item1 ); - - Map item2 = new HashMap(); - item2.put( "name", "Item - 2" ); - item2.put( "description", "The second item" ); - s.persist( "Item", item2 ); - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); - - // First, test iterating the partial iterator; iterate to past - // the first, but not the second, item - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); - s = sessionFactory().getCurrentSession(); - Iterator itr = s.createQuery( "from Item" ).iterate(); - if ( !itr.hasNext() ) { - fail( "No results in iterator" ); - } - itr.next(); - if ( !itr.hasNext() ) { - fail( "Only one result in iterator" ); - } - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); - - // Next, iterate the entire result - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); - s = sessionFactory().getCurrentSession(); - itr = s.createQuery( "from Item" ).iterate(); - if ( !itr.hasNext() ) { - fail( "No results in iterator" ); - } - while ( itr.hasNext() ) { - itr.next(); - } - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); - - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); - s = openSession(); - s.createQuery( "delete from Item" ).executeUpdate(); - TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit(); - } - @Test public void testCurrentSessionWithScroll() throws Exception { TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/AbstractFoo.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/AbstractFoo.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/AbstractFoo.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/AbstractFoo.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Address.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Address.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Address.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Address.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Animal.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Animal.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Animal.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Animal.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Bar.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Bar.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Bar.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Bar.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Bid.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Bid.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Bid.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Bid.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CityState.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CityState.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CityState.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CityState.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Code.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Code.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Code.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Code.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/ComplexJoinAliasTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/ComplexJoinAliasTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/ComplexJoinAliasTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/ComplexJoinAliasTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Country.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Country.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Country.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Country.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Course.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Course.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Course.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Course.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CourseMeeting.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CourseMeeting.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CourseMeeting.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CourseMeeting.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CourseMeetingId.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CourseMeetingId.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CourseMeetingId.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CourseMeetingId.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaAliasFetchTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaAliasFetchTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaAliasFetchTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaAliasFetchTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaLockingTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaLockingTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaLockingTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaLockingTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaOrderByTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaOrderByTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaOrderByTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaOrderByTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaQueryTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriteriaQueryTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criterion/CriterionTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriterionTest.java similarity index 95% rename from hibernate-core/src/test/java/org/hibernate/test/criterion/CriterionTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriterionTest.java index 15876358a7..06030ae2f7 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/criterion/CriterionTest.java +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/CriterionTest.java @@ -1,10 +1,10 @@ /* * 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 . + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html */ -package org.hibernate.test.criterion; +package org.hibernate.test.criteria; import org.hibernate.IrrelevantEntity; import org.hibernate.SessionFactory; diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Enrolment.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Enrolment.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Enrolment.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Enrolment.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Enrolment.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Enrolment.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Enrolment.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Enrolment.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Foo.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Foo.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Foo.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Foo.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/GreatFoo.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/GreatFoo.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/GreatFoo.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/GreatFoo.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/InTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/InTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/InTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/InTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Item.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Item.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Item.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Item.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/LikeTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/LikeTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/LikeTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/LikeTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/ListActionRole.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/ListActionRole.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/ListActionRole.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/ListActionRole.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/LongInElementsTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/LongInElementsTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/LongInElementsTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/LongInElementsTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Man.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Man.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Man.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Man.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criterion/NationalizedIgnoreCaseTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/NationalizedIgnoreCaseTest.java similarity index 93% rename from hibernate-core/src/test/java/org/hibernate/test/criterion/NationalizedIgnoreCaseTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/NationalizedIgnoreCaseTest.java index 93b4b656e7..87644da102 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/criterion/NationalizedIgnoreCaseTest.java +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/NationalizedIgnoreCaseTest.java @@ -1,10 +1,10 @@ /* * 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 . + * License: GNU Lesser General Public License (LGPL), version 2.1 or later + * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html */ -package org.hibernate.test.criterion; +package org.hibernate.test.criteria; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Order.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Order.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Order.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Order.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Order.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Order.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Order.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Order.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/OrderAddress.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderAddress.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/OrderAddress.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderAddress.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/OrderContact.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderContact.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/OrderContact.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderContact.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/OrderLine.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderLine.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/OrderLine.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/OrderLine.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/OuterJoinCriteriaTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/OuterJoinCriteriaTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/OuterJoinCriteriaTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/OuterJoinCriteriaTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Person.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Person.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Person.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Person.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Person.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Person.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Person.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Person.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Role.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Role.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Role.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Role.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/SessionCreateQueryFromCriteriaTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/SessionCreateQueryFromCriteriaTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/SessionCreateQueryFromCriteriaTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/SessionCreateQueryFromCriteriaTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/StringExpression.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/StringExpression.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/StringExpression.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/StringExpression.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Student.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Student.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Student.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Student.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/StudentAddress.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudentAddress.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/StudentAddress.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudentAddress.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/StudentDTO.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudentDTO.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/StudentDTO.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudentDTO.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/StudyAbroad.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudyAbroad.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/StudyAbroad.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/StudyAbroad.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/TestObject.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/TestObject.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/TestObject.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/TestObject.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/TestObject.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/TestObject.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/TestObject.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/TestObject.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/VersionedRecord.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/VersionedRecord.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/VersionedRecord.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/VersionedRecord.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/Woman.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/Woman.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/Woman.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/Woman.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Country.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Country.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Country.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Country.java index 3a2b1023a4..18681f0f42 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Country.java +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Country.java @@ -1,19 +1,19 @@ -/* - * 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.criteria.limitexpression; - -public class Country { - private String code; - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } -} +/* + * 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.criteria.limitexpression; + +public class Country { + private String code; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/LimitExpressionTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/LimitExpressionTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/LimitExpressionTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/LimitExpressionTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Person.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Person.java similarity index 95% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Person.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Person.java index 458b8b77e0..4829d48ecb 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/Person.java +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/Person.java @@ -1,41 +1,41 @@ -/* - * 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.criteria.limitexpression; - -import java.util.Set; - -public class Person { - private Long id; - private Set states; - private Set countries; - - public Set getStates() { - return states; - } - - public void setStates(Set states) { - this.states = states; - } - - public Set getCountries() { - return countries; - } - - public void setCountries(Set countries) { - this.countries = countries; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - -} +/* + * 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.criteria.limitexpression; + +import java.util.Set; + +public class Person { + private Long id; + private Set states; + private Set countries; + + public Set getStates() { + return states; + } + + public void setStates(Set states) { + this.states = states; + } + + public Set getCountries() { + return countries; + } + + public void setCountries(Set countries) { + this.countries = countries; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/UsState.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/UsState.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/UsState.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/UsState.java index 0776d4f7cf..1db54342b4 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/UsState.java +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/UsState.java @@ -1,19 +1,19 @@ -/* - * 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.criteria.limitexpression; - -public class UsState { - private String code; - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } -} +/* + * 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.criteria.limitexpression; + +public class UsState { + private String code; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/domain.hbm.xml b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/domain.hbm.xml similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/domain.hbm.xml rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/domain.hbm.xml index e50d2ad80e..f3e1144574 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/criteria/limitexpression/domain.hbm.xml +++ b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/limitexpression/domain.hbm.xml @@ -1,28 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/CriteriaManyToManyTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/CriteriaManyToManyTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/CriteriaManyToManyTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/CriteriaManyToManyTest.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/Customer.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/Customer.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/Customer.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/Customer.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/Seller.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/Seller.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/many_to_many/Seller.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/many_to_many/Seller.java diff --git a/hibernate-core/src/test/java/org/hibernate/test/criteria/mapsid/MapsIdOneToOneSelectTest.java b/hibernate-core/src/test_legacy/org/hibernate/test/criteria/mapsid/MapsIdOneToOneSelectTest.java similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/test/criteria/mapsid/MapsIdOneToOneSelectTest.java rename to hibernate-core/src/test_legacy/org/hibernate/test/criteria/mapsid/MapsIdOneToOneSelectTest.java