diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaPrimitiveIdTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaPrimitiveIdTest.java index a3208a146f..b23e608b87 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaPrimitiveIdTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaPrimitiveIdTest.java @@ -9,8 +9,6 @@ package org.hibernate.orm.test.query.criteria; import static org.assertj.core.api.Assertions.assertThat; import org.hibernate.Session; -import org.hibernate.metamodel.model.domain.EntityDomainType; -import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.query.Query; import org.hibernate.testing.TestForIssue; @@ -23,6 +21,7 @@ import jakarta.persistence.criteria.CriteriaBuilder; import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.Path; import jakarta.persistence.criteria.Root; +import jakarta.persistence.metamodel.EntityType; import jakarta.persistence.metamodel.SingularAttribute; @TestForIssue(jiraKey = "HHH-15073") @@ -41,17 +40,15 @@ public class CriteriaPrimitiveIdTest extends BaseCoreFunctionalTestCase { session.persist( new MyEntity( 3L ) ); } ); inTransaction( session -> { - EntityDomainType type = sessionFactory().getJpaMetamodel().entity( MyEntity.class ); - @SuppressWarnings("unchecked") - SingularPersistentAttribute idAttribute = - (SingularPersistentAttribute) type.findIdAttribute(); + EntityType type = sessionFactory().getJpaMetamodel().entity( MyEntity.class ); + SingularAttribute idAttribute = type.getId( long.class ); Query query = createQueryForIdentifierListing( session, type, idAttribute ); assertThat( query.list() ).containsExactlyInAnyOrder( 1L, 2L, 3L ); } ); } private Query createQueryForIdentifierListing(Session session, - EntityDomainType type, SingularAttribute idAttribute) { + EntityType type, SingularAttribute idAttribute) { CriteriaBuilder criteriaBuilder = session.getSessionFactory().getCriteriaBuilder(); CriteriaQuery criteriaQuery = criteriaBuilder.createQuery( idAttribute.getJavaType() ); Root root = criteriaQuery.from( type );