From c959c7656c477a350a48266f2ff718ea77b1dcba Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Tue, 7 Dec 2021 10:36:50 +0100 Subject: [PATCH] Fix IdentifiableType#getId(Class type) failing for primitive types --- .../domain/AbstractIdentifiableType.java | 24 ++++--- .../jpa/test/metamodel/EmbeddedTypeTest.java | 71 ------------------- .../JpaMetamodelDisabledPopulationTest.java | 2 + .../JpaMetamodelEnabledPopulationTest.java | 2 + ...etamodelskipUnsupportedPopulationTest.java | 2 + .../jpa/criteria/AbstractCriteriaTest.java | 36 +++++----- .../jpa/criteria/CriteriaCompilingTest.java | 24 +++---- .../criteria/ManipulationCriteriaTest.java | 6 +- .../orm/test/jpa/criteria/OnKeywordTest.java | 8 +-- .../test/jpa/criteria/QueryBuilderTest.java | 26 +++---- .../test/jpa/criteria/TreatKeywordTest.java | 6 +- .../criteria/basic/AggregationResultTest.java | 6 +- .../orm/test/jpa/criteria/basic/CastTest.java | 4 +- .../jpa/criteria/basic/ExpressionsTest.java | 8 +-- .../jpa/criteria/basic/ListIndexTest.java | 8 +-- .../jpa/criteria/basic/PredicateTest.java | 12 ++-- .../idclass/IdClassPredicateTest.java | 2 +- .../jpa/criteria/mapjoin/MapJoinTest.java | 10 +-- .../criteria/paths/AbstractPathImplTest.java | 8 +-- .../jpa/criteria/paths/FetchAndJoinTest.java | 10 +-- .../paths/PluralAttributeExpressionsTest.java | 18 ++--- .../subquery/CorrelatedSubqueryTest.java | 14 ++-- .../subquery/UncorrelatedSubqueryTest.java | 10 +-- .../jpa/criteria/tuple/TupleCriteriaTest.java | 6 +- .../AbstractJpaMetamodelPopulationTest.java | 2 +- .../AbstractMetamodelSpecificTest.java | 2 +- .../test/jpa}/metamodel/Address.java | 2 +- .../test/jpa}/metamodel/Alias.java | 2 +- .../test/jpa}/metamodel/Article.java | 2 +- .../jpa}/metamodel/BaseEmbeddedEntity.java | 2 +- .../test/jpa}/metamodel/Country.java | 2 +- .../test/jpa}/metamodel/CreditCard.java | 2 +- .../test/jpa}/metamodel/Customer.java | 2 +- .../test/jpa/metamodel/EmbeddedTypeTest.java | 71 +++++++++++++++++++ .../test/jpa}/metamodel/Entity1.java | 2 +- .../test/jpa}/metamodel/Entity2.java | 2 +- .../test/jpa}/metamodel/Entity3.java | 2 +- .../test => orm/test/jpa}/metamodel/Info.java | 2 +- .../test/jpa}/metamodel/LineItem.java | 2 +- .../test/jpa}/metamodel/MapEntity.java | 2 +- .../test/jpa}/metamodel/MapEntityLocal.java | 2 +- .../test/jpa}/metamodel/Order.java | 2 +- .../orm/test/jpa/metamodel/Person.java | 2 - .../test/jpa}/metamodel/Phone.java | 2 +- .../test/jpa}/metamodel/Product.java | 2 +- .../test/jpa}/metamodel/ShelfLife.java | 2 +- .../test/jpa}/metamodel/Spouse.java | 2 +- .../test/jpa}/metamodel/Thing.java | 2 +- .../jpa}/metamodel/ThingWithQuantity.java | 2 +- .../test/jpa}/metamodel/Translation.java | 2 +- .../test/jpa}/metamodel/VersionedEntity.java | 2 +- .../criteria/RootEntityTypeModelTest.java | 70 ++++++++++++++++++ 52 files changed, 297 insertions(+), 219 deletions(-) delete mode 100644 hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/EmbeddedTypeTest.java rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/AbstractJpaMetamodelPopulationTest.java (99%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/AbstractMetamodelSpecificTest.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Address.java (97%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Alias.java (98%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Article.java (92%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/BaseEmbeddedEntity.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Country.java (94%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/CreditCard.java (98%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Customer.java (98%) create mode 100644 hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/EmbeddedTypeTest.java rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Entity1.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Entity2.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Entity3.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Info.java (97%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/LineItem.java (96%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/MapEntity.java (95%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/MapEntityLocal.java (92%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Order.java (98%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Phone.java (97%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Product.java (98%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/ShelfLife.java (95%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Spouse.java (98%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Thing.java (94%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/ThingWithQuantity.java (91%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/Translation.java (91%) rename hibernate-core/src/test/java/org/hibernate/{jpa/test => orm/test/jpa}/metamodel/VersionedEntity.java (94%) create mode 100644 hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/RootEntityTypeModelTest.java diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractIdentifiableType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractIdentifiableType.java index 328baf3629..200ac31d15 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractIdentifiableType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractIdentifiableType.java @@ -22,6 +22,7 @@ import org.hibernate.metamodel.model.domain.internal.EmbeddedSqmPathSource; import org.hibernate.metamodel.model.domain.internal.NonAggregatedCompositeSqmPathSource; import org.hibernate.query.sqm.SqmPathSource; import org.hibernate.type.descriptor.java.JavaType; +import org.hibernate.type.descriptor.java.spi.PrimitiveJavaType; import org.jboss.logging.Logger; @@ -142,16 +143,19 @@ public abstract class AbstractIdentifiableType } private void checkType(SingularPersistentAttribute attribute, Class javaType) { - if ( ! javaType.isAssignableFrom( attribute.getType().getJavaType() ) ) { - throw new IllegalArgumentException( - String.format( - "Attribute [%s#%s : %s] not castable to requested type [%s]", - getTypeName(), - attribute.getName(), - attribute.getType().getJavaType().getName(), - javaType.getName() - ) - ); + if ( !javaType.isAssignableFrom( attribute.getType().getJavaType() ) ) { + final JavaType attributeJavaTypeDescriptor = attribute.getAttributeJavaTypeDescriptor(); + if ( !( attributeJavaTypeDescriptor instanceof PrimitiveJavaType ) || ( (PrimitiveJavaType) attributeJavaTypeDescriptor ).getPrimitiveClass() != javaType ) { + throw new IllegalArgumentException( + String.format( + "Attribute [%s#%s : %s] not castable to requested type [%s]", + getTypeName(), + attribute.getName(), + attribute.getType().getJavaType().getName(), + javaType.getName() + ) + ); + } } } diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/EmbeddedTypeTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/EmbeddedTypeTest.java deleted file mode 100644 index 64b55f8c18..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/EmbeddedTypeTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.jpa.test.metamodel; - -import jakarta.persistence.EntityManager; -import jakarta.persistence.metamodel.EntityType; -import jakarta.persistence.metamodel.ManagedType; -import jakarta.persistence.metamodel.SingularAttribute; - -import org.junit.Test; - -import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; - -import org.hibernate.testing.TestForIssue; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -/** - * @author Steve Ebersole - */ -public class EmbeddedTypeTest extends BaseEntityManagerFunctionalTestCase { - @Override - public Class[] getAnnotatedClasses() { - return new Class[] { - Product.class, ShelfLife.class, VersionedEntity.class - }; - } - - @Test - @TestForIssue( jiraKey = "HHH-6896" ) - public void ensureComponentsReturnedAsManagedType() { - ManagedType managedType = entityManagerFactory().getMetamodel().managedType( ShelfLife.class ); - // the issue was in regards to throwing an exception, but also check for nullness - assertNotNull( managedType ); - } - - @Test - @TestForIssue( jiraKey = "HHH-4702" ) - public void testSingularAttributeAccessByName() { - EntityManager em = getOrCreateEntityManager(); - em.getTransaction().begin(); - - SingularAttribute soldDate_ = em.getMetamodel().embeddable( ShelfLife.class ) - .getSingularAttribute( "soldDate" ); - assertEquals( java.sql.Date.class, soldDate_.getBindableJavaType()); - assertEquals( java.sql.Date.class, soldDate_.getType().getJavaType() ); - assertEquals( java.sql.Date.class, soldDate_.getJavaType() ); - - em.getTransaction().commit(); - em.close(); - } - - @Test - @TestForIssue( jiraKey = "HHH-5821" ) - public void testVersionAttributeMetadata() { - EntityManager em = getOrCreateEntityManager(); - EntityType metadata = em.getMetamodel().entity( VersionedEntity.class ); - assertNotNull( metadata.getDeclaredVersion( int.class ) ); - assertTrue( metadata.getDeclaredVersion( int.class ).isVersion() ); - assertEquals( 3, metadata.getDeclaredSingularAttributes().size() ); - assertTrue( metadata.getDeclaredSingularAttributes().contains( metadata.getDeclaredVersion( int.class ) ) ); - em.close(); - } - -} diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelDisabledPopulationTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelDisabledPopulationTest.java index f8e9ee2c37..c4b29629b3 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelDisabledPopulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelDisabledPopulationTest.java @@ -6,6 +6,8 @@ */ package org.hibernate.jpa.test.metamodel; +import org.hibernate.orm.test.jpa.metamodel.AbstractJpaMetamodelPopulationTest; + import org.hibernate.testing.TestForIssue; /** diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelEnabledPopulationTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelEnabledPopulationTest.java index fa1eed1024..c008bf29ae 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelEnabledPopulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelEnabledPopulationTest.java @@ -6,6 +6,8 @@ */ package org.hibernate.jpa.test.metamodel; +import org.hibernate.orm.test.jpa.metamodel.AbstractJpaMetamodelPopulationTest; + import org.hibernate.testing.TestForIssue; /** diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelskipUnsupportedPopulationTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelskipUnsupportedPopulationTest.java index 73dd523c38..30f39c2d0b 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelskipUnsupportedPopulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/JpaMetamodelskipUnsupportedPopulationTest.java @@ -6,6 +6,8 @@ */ package org.hibernate.jpa.test.metamodel; +import org.hibernate.orm.test.jpa.metamodel.AbstractJpaMetamodelPopulationTest; + import org.hibernate.testing.TestForIssue; /** diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/AbstractCriteriaTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/AbstractCriteriaTest.java index 80b86fe85e..9a5ed6cd76 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/AbstractCriteriaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/AbstractCriteriaTest.java @@ -6,24 +6,24 @@ */ package org.hibernate.orm.test.jpa.criteria; -import org.hibernate.jpa.test.metamodel.Address; -import org.hibernate.jpa.test.metamodel.Alias; -import org.hibernate.jpa.test.metamodel.Country; -import org.hibernate.jpa.test.metamodel.CreditCard; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Entity1; -import org.hibernate.jpa.test.metamodel.Entity2; -import org.hibernate.jpa.test.metamodel.Entity3; -import org.hibernate.jpa.test.metamodel.Info; -import org.hibernate.jpa.test.metamodel.LineItem; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Phone; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.ShelfLife; -import org.hibernate.jpa.test.metamodel.Spouse; -import org.hibernate.jpa.test.metamodel.Thing; -import org.hibernate.jpa.test.metamodel.ThingWithQuantity; -import org.hibernate.jpa.test.metamodel.VersionedEntity; +import org.hibernate.orm.test.jpa.metamodel.Address; +import org.hibernate.orm.test.jpa.metamodel.Alias; +import org.hibernate.orm.test.jpa.metamodel.Country; +import org.hibernate.orm.test.jpa.metamodel.CreditCard; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Entity1; +import org.hibernate.orm.test.jpa.metamodel.Entity2; +import org.hibernate.orm.test.jpa.metamodel.Entity3; +import org.hibernate.orm.test.jpa.metamodel.Info; +import org.hibernate.orm.test.jpa.metamodel.LineItem; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Phone; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.ShelfLife; +import org.hibernate.orm.test.jpa.metamodel.Spouse; +import org.hibernate.orm.test.jpa.metamodel.Thing; +import org.hibernate.orm.test.jpa.metamodel.ThingWithQuantity; +import org.hibernate.orm.test.jpa.metamodel.VersionedEntity; import org.hibernate.testing.orm.junit.Jpa; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaCompilingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaCompilingTest.java index 06830d5949..e5e6149a19 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaCompilingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaCompilingTest.java @@ -29,18 +29,18 @@ import org.hibernate.orm.test.jpa.callbacks.Television; import org.hibernate.orm.test.jpa.callbacks.VideoSystem; import org.hibernate.orm.test.jpa.inheritance.Fruit; import org.hibernate.orm.test.jpa.inheritance.Strawberry; -import org.hibernate.jpa.test.metamodel.Address; -import org.hibernate.jpa.test.metamodel.Alias; -import org.hibernate.jpa.test.metamodel.Country; -import org.hibernate.jpa.test.metamodel.CreditCard; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Info; -import org.hibernate.jpa.test.metamodel.LineItem; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Phone; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.ShelfLife; -import org.hibernate.jpa.test.metamodel.Spouse; +import org.hibernate.orm.test.jpa.metamodel.Address; +import org.hibernate.orm.test.jpa.metamodel.Alias; +import org.hibernate.orm.test.jpa.metamodel.Country; +import org.hibernate.orm.test.jpa.metamodel.CreditCard; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Info; +import org.hibernate.orm.test.jpa.metamodel.LineItem; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Phone; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.ShelfLife; +import org.hibernate.orm.test.jpa.metamodel.Spouse; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.transaction.TransactionUtil; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/ManipulationCriteriaTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/ManipulationCriteriaTest.java index a4cd36de60..b8a06b35eb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/ManipulationCriteriaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/ManipulationCriteriaTest.java @@ -15,9 +15,9 @@ import jakarta.persistence.criteria.Root; import jakarta.persistence.criteria.Subquery; import org.hibernate.dialect.MySQLDialect; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Customer_; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/OnKeywordTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/OnKeywordTest.java index a94e616b47..cd238b70a0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/OnKeywordTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/OnKeywordTest.java @@ -10,10 +10,10 @@ import jakarta.persistence.criteria.CollectionJoin; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.LineItem; -import org.hibernate.jpa.test.metamodel.LineItem_; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Order_; +import org.hibernate.orm.test.jpa.metamodel.LineItem; +import org.hibernate.orm.test.jpa.metamodel.LineItem_; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Order_; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/QueryBuilderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/QueryBuilderTest.java index 718c90694b..f38d02cfd3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/QueryBuilderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/QueryBuilderTest.java @@ -22,19 +22,19 @@ import jakarta.persistence.criteria.SetJoin; import jakarta.persistence.metamodel.EntityType; import org.hibernate.dialect.CockroachDialect; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; -import org.hibernate.jpa.test.metamodel.Address; -import org.hibernate.jpa.test.metamodel.Alias; -import org.hibernate.jpa.test.metamodel.Country; -import org.hibernate.jpa.test.metamodel.CreditCard; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Customer_; -import org.hibernate.jpa.test.metamodel.Info; -import org.hibernate.jpa.test.metamodel.LineItem; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Phone; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.ShelfLife; -import org.hibernate.jpa.test.metamodel.Spouse; +import org.hibernate.orm.test.jpa.metamodel.Address; +import org.hibernate.orm.test.jpa.metamodel.Alias; +import org.hibernate.orm.test.jpa.metamodel.Country; +import org.hibernate.orm.test.jpa.metamodel.CreditCard; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.Info; +import org.hibernate.orm.test.jpa.metamodel.LineItem; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Phone; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.ShelfLife; +import org.hibernate.orm.test.jpa.metamodel.Spouse; import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl; import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/TreatKeywordTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/TreatKeywordTest.java index 2afc87a7ea..51e8c3e4bb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/TreatKeywordTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/TreatKeywordTest.java @@ -19,9 +19,9 @@ import jakarta.persistence.criteria.Root; import jakarta.persistence.metamodel.EntityType; import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase; -import org.hibernate.jpa.test.metamodel.Thing; -import org.hibernate.jpa.test.metamodel.ThingWithQuantity; -import org.hibernate.jpa.test.metamodel.ThingWithQuantity_; +import org.hibernate.orm.test.jpa.metamodel.Thing; +import org.hibernate.orm.test.jpa.metamodel.ThingWithQuantity; +import org.hibernate.orm.test.jpa.metamodel.ThingWithQuantity_; import org.hibernate.testing.TestForIssue; import org.junit.Assert; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/AggregationResultTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/AggregationResultTest.java index 95fbc71782..f542928803 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/AggregationResultTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/AggregationResultTest.java @@ -13,9 +13,9 @@ import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.Product_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.Product_; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/CastTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/CastTest.java index 86a39c84c8..e0de08dc0e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/CastTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/CastTest.java @@ -14,8 +14,8 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Root; import org.hibernate.dialect.DerbyDialect; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.Product_; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.Product_; import org.hibernate.orm.test.jpa.criteria.AbstractCriteriaTest; import org.hibernate.testing.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ExpressionsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ExpressionsTest.java index 513389c9bd..761c9d5bd0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ExpressionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ExpressionsTest.java @@ -21,10 +21,10 @@ import jakarta.persistence.criteria.Root; import org.hibernate.dialect.DB2Dialect; import org.hibernate.dialect.DerbyDialect; import org.hibernate.query.Query; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Phone; -import org.hibernate.jpa.test.metamodel.Product; -import org.hibernate.jpa.test.metamodel.Product_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Phone; +import org.hibernate.orm.test.jpa.metamodel.Product; +import org.hibernate.orm.test.jpa.metamodel.Product_; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ListIndexTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ListIndexTest.java index 426dbe59de..8bc84690eb 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ListIndexTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/ListIndexTest.java @@ -14,10 +14,10 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.ListJoin; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Address; -import org.hibernate.jpa.test.metamodel.Address_; -import org.hibernate.jpa.test.metamodel.Phone; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Address; +import org.hibernate.orm.test.jpa.metamodel.Address_; +import org.hibernate.orm.test.jpa.metamodel.Phone; import org.hibernate.testing.TestForIssue; import org.junit.jupiter.api.AfterEach; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/PredicateTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/PredicateTest.java index 8448c036b5..ff410b12ad 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/PredicateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/basic/PredicateTest.java @@ -16,12 +16,12 @@ import jakarta.persistence.criteria.Root; import org.hibernate.dialect.CockroachDialect; import org.hibernate.dialect.OracleDialect; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.CreditCard; -import org.hibernate.jpa.test.metamodel.CreditCard_; -import org.hibernate.jpa.test.metamodel.Customer_; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Order_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.CreditCard; +import org.hibernate.orm.test.jpa.metamodel.CreditCard_; +import org.hibernate.orm.test.jpa.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Order_; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/idclass/IdClassPredicateTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/idclass/IdClassPredicateTest.java index f2b90b76f3..ac6f2e34ee 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/idclass/IdClassPredicateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/idclass/IdClassPredicateTest.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; /** * @author Erich Heard diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/mapjoin/MapJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/mapjoin/MapJoinTest.java index 530a155447..6880e7515e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/mapjoin/MapJoinTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/mapjoin/MapJoinTest.java @@ -12,11 +12,11 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.MapJoin; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.MapEntity; -import org.hibernate.jpa.test.metamodel.MapEntityLocal; -import org.hibernate.jpa.test.metamodel.MapEntityLocal_; -import org.hibernate.jpa.test.metamodel.MapEntity_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.MapEntity; +import org.hibernate.orm.test.jpa.metamodel.MapEntityLocal; +import org.hibernate.orm.test.jpa.metamodel.MapEntityLocal_; +import org.hibernate.orm.test.jpa.metamodel.MapEntity_; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/AbstractPathImplTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/AbstractPathImplTest.java index b3d002c5aa..e459f84010 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/AbstractPathImplTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/AbstractPathImplTest.java @@ -12,10 +12,10 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Thing; -import org.hibernate.jpa.test.metamodel.ThingWithQuantity; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Thing; +import org.hibernate.orm.test.jpa.metamodel.ThingWithQuantity; import org.hibernate.testing.orm.junit.ExpectedException; import org.junit.jupiter.api.AfterEach; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/FetchAndJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/FetchAndJoinTest.java index 4d9302d0d7..36bde58919 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/FetchAndJoinTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/FetchAndJoinTest.java @@ -31,11 +31,11 @@ import jakarta.persistence.criteria.Join; import jakarta.persistence.criteria.JoinType; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Entity1; -import org.hibernate.jpa.test.metamodel.Entity1_; -import org.hibernate.jpa.test.metamodel.Entity2; -import org.hibernate.jpa.test.metamodel.Entity2_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Entity1; +import org.hibernate.orm.test.jpa.metamodel.Entity1_; +import org.hibernate.orm.test.jpa.metamodel.Entity2; +import org.hibernate.orm.test.jpa.metamodel.Entity2_; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/PluralAttributeExpressionsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/PluralAttributeExpressionsTest.java index d424873a53..8d13761af3 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/PluralAttributeExpressionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/paths/PluralAttributeExpressionsTest.java @@ -12,15 +12,15 @@ import java.util.List; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Address; -import org.hibernate.jpa.test.metamodel.Address_; -import org.hibernate.jpa.test.metamodel.Article; -import org.hibernate.jpa.test.metamodel.Article_; -import org.hibernate.jpa.test.metamodel.MapEntity; -import org.hibernate.jpa.test.metamodel.MapEntityLocal; -import org.hibernate.jpa.test.metamodel.MapEntity_; -import org.hibernate.jpa.test.metamodel.Translation; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Address; +import org.hibernate.orm.test.jpa.metamodel.Address_; +import org.hibernate.orm.test.jpa.metamodel.Article; +import org.hibernate.orm.test.jpa.metamodel.Article_; +import org.hibernate.orm.test.jpa.metamodel.MapEntity; +import org.hibernate.orm.test.jpa.metamodel.MapEntityLocal; +import org.hibernate.orm.test.jpa.metamodel.MapEntity_; +import org.hibernate.orm.test.jpa.metamodel.Translation; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaExpression; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java index 91022e43fb..f2b5e3847b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/CorrelatedSubqueryTest.java @@ -16,13 +16,13 @@ import jakarta.persistence.criteria.Root; import jakarta.persistence.criteria.Subquery; import org.hibernate.dialect.SybaseASEDialect; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Customer_; -import org.hibernate.jpa.test.metamodel.LineItem; -import org.hibernate.jpa.test.metamodel.LineItem_; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Order_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.LineItem; +import org.hibernate.orm.test.jpa.metamodel.LineItem_; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Order_; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.SkipForDialect; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/UncorrelatedSubqueryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/UncorrelatedSubqueryTest.java index f41894d295..861ef6b0ba 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/UncorrelatedSubqueryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/subquery/UncorrelatedSubqueryTest.java @@ -13,11 +13,11 @@ import jakarta.persistence.criteria.Join; import jakarta.persistence.criteria.Root; import jakarta.persistence.criteria.Subquery; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Customer_; -import org.hibernate.jpa.test.metamodel.Order; -import org.hibernate.jpa.test.metamodel.Order_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.Order; +import org.hibernate.orm.test.jpa.metamodel.Order_; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/tuple/TupleCriteriaTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/tuple/TupleCriteriaTest.java index 704c1c5732..f4ccd3bbb1 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/tuple/TupleCriteriaTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/tuple/TupleCriteriaTest.java @@ -16,9 +16,9 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Root; -import org.hibernate.jpa.test.metamodel.AbstractMetamodelSpecificTest; -import org.hibernate.jpa.test.metamodel.Customer; -import org.hibernate.jpa.test.metamodel.Customer_; +import org.hibernate.orm.test.jpa.metamodel.AbstractMetamodelSpecificTest; +import org.hibernate.orm.test.jpa.metamodel.Customer; +import org.hibernate.orm.test.jpa.metamodel.Customer_; import org.junit.jupiter.api.Test; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractJpaMetamodelPopulationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractJpaMetamodelPopulationTest.java similarity index 99% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractJpaMetamodelPopulationTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractJpaMetamodelPopulationTest.java index 609fbd5001..8f227398a3 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractJpaMetamodelPopulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractJpaMetamodelPopulationTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.io.Serializable; import java.util.Map; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractMetamodelSpecificTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractMetamodelSpecificTest.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractMetamodelSpecificTest.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractMetamodelSpecificTest.java index 4fb39e65cc..053f50081f 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/AbstractMetamodelSpecificTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/AbstractMetamodelSpecificTest.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.EntityManager; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Address.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Address.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Address.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Address.java index 13a2715a8e..1fd0c45617 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Address.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Address.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.List; import jakarta.persistence.CascadeType; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Alias.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Alias.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Alias.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Alias.java index c3ef2543e0..a876950d78 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Alias.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Alias.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Collection; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Article.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Article.java similarity index 92% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Article.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Article.java index f6db94d16f..1a86edbc11 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Article.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Article.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Locale; import java.util.Map; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/BaseEmbeddedEntity.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/BaseEmbeddedEntity.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/BaseEmbeddedEntity.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/BaseEmbeddedEntity.java index 43cb04f534..d34a0ca251 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/BaseEmbeddedEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/BaseEmbeddedEntity.java @@ -5,7 +5,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.io.Serializable; import jakarta.persistence.EmbeddedId; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Country.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Country.java similarity index 94% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Country.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Country.java index 4db3ca627f..773a4de3d8 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Country.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Country.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Basic; import jakarta.persistence.Embeddable; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/CreditCard.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/CreditCard.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/CreditCard.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/CreditCard.java index 9001125291..88359952ed 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/CreditCard.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/CreditCard.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Customer.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Customer.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Customer.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Customer.java index dd90fce4c3..2b738f6040 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Customer.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Customer.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Collection; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/EmbeddedTypeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/EmbeddedTypeTest.java new file mode 100644 index 0000000000..108fd4df1b --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/EmbeddedTypeTest.java @@ -0,0 +1,71 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ +package org.hibernate.orm.test.jpa.metamodel; + +import java.sql.Date; + +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; +import org.hibernate.testing.orm.junit.Jpa; +import org.junit.jupiter.api.Test; + +import jakarta.persistence.metamodel.EntityType; +import jakarta.persistence.metamodel.ManagedType; +import jakarta.persistence.metamodel.SingularAttribute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * @author Steve Ebersole + */ +@Jpa( + annotatedClasses = { Product.class, ShelfLife.class, VersionedEntity.class } +) +public class EmbeddedTypeTest { + + @Test + @TestForIssue(jiraKey = "HHH-6896") + public void ensureComponentsReturnedAsManagedType(EntityManagerFactoryScope scope) { + ManagedType managedType = scope.getEntityManagerFactory() + .getMetamodel() + .managedType( ShelfLife.class ); + // the issue was in regards to throwing an exception, but also check for nullness + assertNotNull( managedType ); + } + + @Test + @TestForIssue(jiraKey = "HHH-4702") + public void testSingularAttributeAccessByName(EntityManagerFactoryScope scope) { + scope.inTransaction( + entityManager -> { + SingularAttribute soldDate_ = entityManager.getMetamodel().embeddable( ShelfLife.class ) + .getSingularAttribute( "soldDate" ); + assertEquals( Date.class, soldDate_.getBindableJavaType() ); + assertEquals( Date.class, soldDate_.getType().getJavaType() ); + assertEquals( Date.class, soldDate_.getJavaType() ); + } + ); + } + + @Test + @TestForIssue(jiraKey = "HHH-5821") + public void testVersionAttributeMetadata(EntityManagerFactoryScope scope) { + scope.inEntityManager( + entityManager -> { + EntityType metadata = entityManager.getMetamodel().entity( VersionedEntity.class ); + assertNotNull( metadata.getDeclaredVersion( int.class ) ); + assertTrue( metadata.getDeclaredVersion( int.class ).isVersion() ); + assertEquals( 3, metadata.getDeclaredSingularAttributes().size() ); + assertTrue( metadata.getDeclaredSingularAttributes() + .contains( metadata.getDeclaredVersion( int.class ) ) ); + } + ); + } + +} diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity1.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity1.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity1.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity1.java index 0c5d3d5f69..fc78f875c0 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity1.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity1.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity2.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity2.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity2.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity2.java index d9f014f492..0bc49de5e1 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity2.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity2.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity3.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity3.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity3.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity3.java index 0581c68ec1..b9cf7b03e2 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Entity3.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Entity3.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Info.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Info.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Info.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Info.java index 48eac7028a..d0b5cf4e4f 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Info.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Info.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/LineItem.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/LineItem.java similarity index 96% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/LineItem.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/LineItem.java index aaafbbb579..39c55c025a 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/LineItem.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/LineItem.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntity.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntity.java similarity index 95% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntity.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntity.java index bf1ff647c4..8b9193a1ef 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntity.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Map; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntityLocal.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntityLocal.java similarity index 92% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntityLocal.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntityLocal.java index 4f51dd5fbb..35b01b4242 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/MapEntityLocal.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/MapEntityLocal.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Column; import jakarta.persistence.Embeddable; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Order.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Order.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Order.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Order.java index d838f23c38..db8698bd19 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Order.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Order.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Collection; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Person.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Person.java index 50ae1ed1e5..a61cac7970 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Person.java @@ -8,8 +8,6 @@ package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; -import org.hibernate.jpa.test.metamodel.BaseEmbeddedEntity; - /** * @author Christian Beikov */ diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Phone.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Phone.java similarity index 97% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Phone.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Phone.java index 27d0068222..95df0ff14a 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Phone.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Phone.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.util.Set; import jakarta.persistence.Column; import jakarta.persistence.ElementCollection; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Product.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Product.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Product.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Product.java index ff3f42c3ff..7b688466b3 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Product.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Product.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.math.BigDecimal; import java.math.BigInteger; import jakarta.persistence.AttributeOverride; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ShelfLife.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ShelfLife.java similarity index 95% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ShelfLife.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ShelfLife.java index d35808b4c8..6376f052d3 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ShelfLife.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ShelfLife.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import java.sql.Date; import jakarta.persistence.Basic; import jakarta.persistence.Embeddable; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Spouse.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Spouse.java similarity index 98% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Spouse.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Spouse.java index f467793f00..ac6365cdaa 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Spouse.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Spouse.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Thing.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Thing.java similarity index 94% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Thing.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Thing.java index 05afbea52d..c0199bac27 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Thing.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Thing.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ThingWithQuantity.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ThingWithQuantity.java similarity index 91% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ThingWithQuantity.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ThingWithQuantity.java index 44690d01e3..6f37687d0e 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/ThingWithQuantity.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/ThingWithQuantity.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Translation.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Translation.java similarity index 91% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Translation.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Translation.java index f1486b2bfd..867c4a995c 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/Translation.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/Translation.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/VersionedEntity.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/VersionedEntity.java similarity index 94% rename from hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/VersionedEntity.java rename to hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/VersionedEntity.java index c507a1e0b8..b539145fed 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/metamodel/VersionedEntity.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/metamodel/VersionedEntity.java @@ -4,7 +4,7 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.jpa.test.metamodel; +package org.hibernate.orm.test.jpa.metamodel; import jakarta.persistence.Entity; import jakarta.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/RootEntityTypeModelTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/RootEntityTypeModelTest.java new file mode 100644 index 0000000000..20a14925ca --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/RootEntityTypeModelTest.java @@ -0,0 +1,70 @@ +package org.hibernate.orm.test.query.criteria; + +import org.hibernate.testing.orm.junit.DomainModel; +import org.hibernate.testing.orm.junit.SessionFactory; +import org.hibernate.testing.orm.junit.SessionFactoryScope; + + +import org.junit.jupiter.api.Test; + +import jakarta.persistence.Basic; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Root; + +import static org.assertj.core.api.Assertions.assertThat; + +@DomainModel( + annotatedClasses = { RootEntityTypeModelTest.Company.class } +) +@SessionFactory +public class RootEntityTypeModelTest { + + @Test + public void test(SessionFactoryScope scope) { + scope.inTransaction( ( session ) -> { + CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder(); + CriteriaQuery criteria = criteriaBuilder.createQuery(); + Root root = criteria.from( Company.class ); + assertThat( root.getModel().getId( int.class ) ).isNotNull(); + } ); + } + + @Entity + public static class Company { + + @Id + @GeneratedValue + private int id; + + @Basic + private String name; + + public Company() { + } + + public Company(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } + +}