diff --git a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaFrom.java b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaFrom.java index 8f2c8303d8..c994e1ae3a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaFrom.java +++ b/hibernate-core/src/main/java/org/hibernate/query/criteria/JpaFrom.java @@ -36,10 +36,20 @@ public interface JpaFrom extends JpaPath, JpaFetchParent, From @Override JpaEntityJoin join(Class entityClass, JoinType joinType); + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #join(Class, org.hibernate.query.common.JoinType)} + */ + @Deprecated(since="7", forRemoval = true) default JpaEntityJoin join(Class entityJavaType, SqmJoinType joinType) { return join( entityJavaType, joinType.getCorrespondingJpaJoinType() ); } + default JpaEntityJoin join(Class entityJavaType, org.hibernate.query.common.JoinType joinType) { + return join( entityJavaType, SqmJoinType.from(joinType) ); + } + @Override JpaJoin join(EntityType entity); @@ -48,23 +58,60 @@ public interface JpaFrom extends JpaPath, JpaFetchParent, From JpaEntityJoin join(EntityDomainType entity); + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #join(EntityDomainType, org.hibernate.query.common.JoinType)} + */ + @Deprecated(since = "7", forRemoval = true) JpaEntityJoin join(EntityDomainType entity, SqmJoinType joinType); + default JpaEntityJoin join(EntityDomainType entity, org.hibernate.query.common.JoinType joinType) { + return join( entity, SqmJoinType.from(joinType) ); + } + @Incubating JpaDerivedJoin join(Subquery subquery); - @Incubating + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #join(Subquery, org.hibernate.query.common.JoinType)} + */ + @Incubating @Deprecated(since = "7", forRemoval = true) JpaDerivedJoin join(Subquery subquery, SqmJoinType joinType); + default JpaDerivedJoin join(Subquery subquery, org.hibernate.query.common.JoinType joinType) { + return join( subquery, SqmJoinType.from(joinType) ); + } + @Incubating JpaDerivedJoin joinLateral(Subquery subquery); - @Incubating + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #joinLateral(Subquery, org.hibernate.query.common.JoinType)} + */ + @Incubating @Deprecated(since = "7", forRemoval = true) JpaDerivedJoin joinLateral(Subquery subquery, SqmJoinType joinType); - @Incubating + default JpaDerivedJoin joinLateral(Subquery subquery, org.hibernate.query.common.JoinType joinType) { + return joinLateral( subquery, SqmJoinType.from(joinType) ); + } + + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #join(Subquery, org.hibernate.query.common.JoinType, boolean)} + */ + @Incubating @Deprecated(since = "7", forRemoval = true) JpaDerivedJoin join(Subquery subquery, SqmJoinType joinType, boolean lateral); + default JpaDerivedJoin join(Subquery subquery, org.hibernate.query.common.JoinType joinType, boolean lateral) { + return join( subquery, SqmJoinType.from(joinType), lateral ); + } + /** * Like calling the overload {@link #join(JpaSetReturningFunction, SqmJoinType)} with {@link SqmJoinType#INNER}. * @@ -192,9 +239,18 @@ public interface JpaFrom extends JpaPath, JpaFetchParent, From @Incubating JpaJoin join(JpaCteCriteria cte); - @Incubating + /** + * @deprecated This method is a layer-breaker, leaking the SQM type + * {@link SqmJoinType} onto an API. It will be removed. + * Use {@link #join(JpaCteCriteria, org.hibernate.query.common.JoinType)} + */ + @Incubating @Deprecated(since = "7", forRemoval = true) JpaJoin join(JpaCteCriteria cte, SqmJoinType joinType); + default JpaJoin join(JpaCteCriteria cte, org.hibernate.query.common.JoinType joinType) { + return join( cte, SqmJoinType.from(joinType) ); + } + @Incubating JpaCrossJoin crossJoin(Class entityJavaType); diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/JoinType.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/JoinType.java new file mode 100644 index 0000000000..ea149bfd6d --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/JoinType.java @@ -0,0 +1,35 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.query.common; + +/** + * Enumerates the possible kinds of join in HQL and ANSI SQL. + * + * @apiNote This enumeration competes with + * {@link jakarta.persistence.criteria.JoinType}, + * adding {@link #FULL} and {@link #CROSS} joins. + * + * @author Gavin King + * + * @since 7 + * + * @see jakarta.persistence.criteria.JoinType + */ +public enum JoinType { + /** + * @see jakarta.persistence.criteria.JoinType#INNER + */ + INNER, + /** + * @see jakarta.persistence.criteria.JoinType#LEFT + */ + LEFT, + /** + * @see jakarta.persistence.criteria.JoinType#RIGHT + */ + RIGHT, + FULL, + CROSS +} diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmJoinType.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmJoinType.java index b9b45ac6f5..08d101e12d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmJoinType.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/SqmJoinType.java @@ -4,92 +4,102 @@ */ package org.hibernate.query.sqm.tree; +import org.hibernate.query.common.JoinType; import org.hibernate.sql.ast.SqlAstJoinType; /** * Represents a canonical join type. - *

- * Note that currently HQL really only supports inner and left outer joins - * (though cross joins can also be achieved). This is because joins in HQL - * are always defined in relation to a mapped association. However, when we - * start allowing users to specify ad-hoc joins this may need to change to - * allow the full spectrum of join types. Thus the others are provided here - * currently just for completeness and for future expansion. * * @author Steve Ebersole + * + * @see JoinType + * @see SqlAstJoinType */ public enum SqmJoinType { /** * Represents an inner join. */ - INNER( "inner", SqlAstJoinType.INNER, jakarta.persistence.criteria.JoinType.INNER ), + INNER, /** * Represents a left outer join. */ - LEFT( "left outer", SqlAstJoinType.LEFT, jakarta.persistence.criteria.JoinType.LEFT ), + LEFT, /** * Represents a right outer join. */ - RIGHT( "right outer", SqlAstJoinType.RIGHT, jakarta.persistence.criteria.JoinType.RIGHT ), + RIGHT, /** * Represents a cross join (aka a cartesian product). */ - CROSS( "cross", SqlAstJoinType.CROSS, null ), + CROSS, /** * Represents a full join. */ - FULL( "full", SqlAstJoinType.FULL, null ); - - private final String text; - private final SqlAstJoinType correspondingSqlAstJoinType; - private final jakarta.persistence.criteria.JoinType correspondingJpaJoinType; - - SqmJoinType( - String text, - SqlAstJoinType correspondingSqlAstJoinType, - jakarta.persistence.criteria.JoinType correspondingJpaJoinType) { - this.text = text; - this.correspondingSqlAstJoinType = correspondingSqlAstJoinType; - this.correspondingJpaJoinType = correspondingJpaJoinType; - } + FULL; @Override public String toString() { - return text; + return getText(); } public String getText() { - return text; + return switch (this) { + case RIGHT -> "right outer"; + case LEFT -> "left outer"; + case INNER -> "inner"; + case FULL -> "full"; + case CROSS -> "cross"; + }; } public SqlAstJoinType getCorrespondingSqlJoinType() { - return correspondingSqlAstJoinType; + return switch (this) { + case RIGHT -> SqlAstJoinType.RIGHT; + case LEFT -> SqlAstJoinType.LEFT; + case INNER -> SqlAstJoinType.INNER; + case FULL -> SqlAstJoinType.FULL; + case CROSS -> SqlAstJoinType.CROSS; + }; } public jakarta.persistence.criteria.JoinType getCorrespondingJpaJoinType() { - return correspondingJpaJoinType; + return switch (this) { + case RIGHT -> jakarta.persistence.criteria.JoinType.RIGHT; + case LEFT -> jakarta.persistence.criteria.JoinType.LEFT; + case INNER -> jakarta.persistence.criteria.JoinType.INNER; + default -> null; + }; + } + + public JoinType getCorrespondingJoinType() { + return switch (this) { + case RIGHT -> JoinType.RIGHT; + case LEFT -> JoinType.LEFT; + case INNER -> JoinType.INNER; + case FULL -> JoinType.FULL; + case CROSS -> JoinType.CROSS; + }; + } + + public static SqmJoinType from(JoinType joinType) { + return switch ( joinType ) { + case INNER -> INNER; + case LEFT -> LEFT; + case RIGHT -> RIGHT; + case CROSS -> CROSS; + case FULL -> FULL; + }; } - @SuppressWarnings("DuplicateBranchesInSwitch") public static SqmJoinType from(jakarta.persistence.criteria.JoinType jpaJoinType) { - switch ( jpaJoinType ) { - case INNER: { - return INNER; - } - case LEFT: { - return LEFT; - } - case RIGHT: { - return RIGHT; - } - default: { - // generally speaking, the default for JPA JoinType is INNER - return INNER; - } - } + return switch ( jpaJoinType ) { + case INNER -> INNER; + case LEFT -> LEFT; + case RIGHT -> RIGHT; + }; } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaQualifiedJoinTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaQualifiedJoinTest.java index bdc8da9076..c511f983fd 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaQualifiedJoinTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/CriteriaQualifiedJoinTest.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.List; import org.hibernate.Session; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaCrossJoin; @@ -18,7 +19,6 @@ import org.hibernate.query.criteria.JpaJoin; import org.hibernate.query.criteria.JpaPath; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; @@ -94,7 +94,7 @@ public class CriteriaQualifiedJoinTest { final HibernateCriteriaBuilder cb = entityManager.unwrap( Session.class ).getCriteriaBuilder(); final JpaCriteriaQuery query = cb.createTupleQuery(); final JpaRoot root = query.from( Primary.class ); - final JpaEntityJoin entityJoin = root.join( Secondary.class, SqmJoinType.INNER ); + final JpaEntityJoin entityJoin = root.join( Secondary.class, JoinType.INNER ); final JpaPath id = root.get( "id" ); entityJoin.on( cb.equal( id, entityJoin.get( "id" ) ) ); final JpaPath name = entityJoin.get( "name" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java index 45c1ed1a1f..6de87674a4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromEmbeddedIdTests.java @@ -6,13 +6,13 @@ package org.hibernate.orm.test.query; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.DialectFeatureChecks; @@ -64,7 +64,7 @@ public class SubQueryInFromEmbeddedIdTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -114,7 +114,7 @@ public class SubQueryInFromEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -162,7 +162,7 @@ public class SubQueryInFromEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java index 5c1d07e949..ff089bd62d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromIdClassTests.java @@ -6,13 +6,13 @@ package org.hibernate.orm.test.query; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromIdClassTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id1" ), a.get( "contact" ).get( "id2" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); @@ -113,7 +113,7 @@ public class SubQueryInFromIdClassTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -161,7 +161,7 @@ public class SubQueryInFromIdClassTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneEmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneEmbeddedIdTests.java index 35761f7650..3818ab10af 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneEmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneEmbeddedIdTests.java @@ -6,13 +6,13 @@ package org.hibernate.orm.test.query; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromInverseOneEmbeddedIdTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -112,7 +112,7 @@ public class SubQueryInFromInverseOneEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -160,7 +160,7 @@ public class SubQueryInFromInverseOneEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneIdClassTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneIdClassTests.java index 06396b1de3..6c435c9841 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneIdClassTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneIdClassTests.java @@ -6,13 +6,13 @@ package org.hibernate.orm.test.query; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromInverseOneIdClassTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id1" ), a.get( "contact" ).get( "id2" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); @@ -113,7 +113,7 @@ public class SubQueryInFromInverseOneIdClassTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -161,7 +161,7 @@ public class SubQueryInFromInverseOneIdClassTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneTests.java index 8c7db7f3f0..090544adc4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromInverseOneTests.java @@ -6,13 +6,13 @@ package org.hibernate.orm.test.query; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromInverseOneTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -110,7 +110,7 @@ public class SubQueryInFromInverseOneTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -158,7 +158,7 @@ public class SubQueryInFromInverseOneTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyEmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyEmbeddedIdTests.java index 5529496bd7..98c440a5d9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyEmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyEmbeddedIdTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromManyToManyEmbeddedIdTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -112,7 +112,7 @@ public class SubQueryInFromManyToManyEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -160,7 +160,7 @@ public class SubQueryInFromManyToManyEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyIdClassTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyIdClassTests.java index 38369e7692..5ebee75dca 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyIdClassTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyIdClassTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromManyToManyIdClassTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id1" ), a.get( "contact" ).get( "id2" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); @@ -113,7 +113,7 @@ public class SubQueryInFromManyToManyIdClassTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -161,7 +161,7 @@ public class SubQueryInFromManyToManyIdClassTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyTests.java index fb73eb2945..0d77aeb029 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromManyToManyTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -62,7 +62,7 @@ public class SubQueryInFromManyToManyTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -110,7 +110,7 @@ public class SubQueryInFromManyToManyTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -158,7 +158,7 @@ public class SubQueryInFromManyToManyTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyEmbeddedIdTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyEmbeddedIdTests.java index 2a820cfe55..1394603bb9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyEmbeddedIdTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyEmbeddedIdTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -64,7 +64,7 @@ public class SubQueryInFromOneToManyEmbeddedIdTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -114,7 +114,7 @@ public class SubQueryInFromOneToManyEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -162,7 +162,7 @@ public class SubQueryInFromOneToManyEmbeddedIdTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyIdClassTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyIdClassTests.java index 01bc20f461..a3cdc07182 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyIdClassTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyIdClassTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -64,7 +64,7 @@ public class SubQueryInFromOneToManyIdClassTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id1" ), a.get( "contact" ).get( "id2" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); @@ -115,7 +115,7 @@ public class SubQueryInFromOneToManyIdClassTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -163,7 +163,7 @@ public class SubQueryInFromOneToManyIdClassTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id1" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyTests.java index 08ebd66a8d..7b223088c2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromOneToManyTests.java @@ -7,13 +7,13 @@ package org.hibernate.orm.test.query; import java.util.Set; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; @@ -64,7 +64,7 @@ public class SubQueryInFromOneToManyTests { subquery.orderBy( cb.asc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); @@ -112,7 +112,7 @@ public class SubQueryInFromOneToManyTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -160,7 +160,7 @@ public class SubQueryInFromOneToManyTests { subquery.orderBy( cb.desc( alternativeContacts.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.orderBy( cb.asc( root.get( "id" ) ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromTests.java index d96812c997..0f9f5e93aa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/SubQueryInFromTests.java @@ -8,6 +8,7 @@ import java.time.LocalDate; import java.util.List; import java.util.function.Consumer; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaDerivedJoin; @@ -16,7 +17,6 @@ import org.hibernate.query.criteria.JpaRoot; import org.hibernate.query.criteria.JpaSubQuery; import org.hibernate.query.spi.QueryImplementor; import org.hibernate.query.sqm.InterpretationException; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.Jira; import org.hibernate.testing.orm.junit.RequiresDialectFeature; @@ -143,7 +143,7 @@ public class SubQueryInFromTests { subquery.orderBy( cb.asc( address.get( "line1" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.INNER ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.INNER ); cq.multiselect( root.get( "name" ), a.get( "address" ) ); @@ -230,7 +230,7 @@ public class SubQueryInFromTests { subquery.orderBy( cb.asc( address.get( "line1" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.INNER ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.INNER ); cq.multiselect( root.get( "name" ), a.get( "zip" ) ); @@ -313,7 +313,7 @@ public class SubQueryInFromTests { subquery.orderBy( cb.asc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "id" ) ); cq.where( cb.equal( root.get( "id" ), 1 ) ); @@ -359,7 +359,7 @@ public class SubQueryInFromTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); final Join alt = a.join( "contact" ); cq.multiselect( root.get( "name" ), alt.get( "name" ) ); @@ -407,7 +407,7 @@ public class SubQueryInFromTests { subquery.orderBy( cb.desc( alternativeContact.get( "name" ).get( "first" ) ) ); subquery.fetch( 1 ); - final JpaDerivedJoin a = root.joinLateral( subquery, SqmJoinType.LEFT ); + final JpaDerivedJoin a = root.joinLateral( subquery, JoinType.LEFT ); cq.multiselect( root.get( "name" ), a.get( "contact" ).get( "name" ) ); cq.where( cb.equal( root.get( "id" ), 1 ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java index b1bb271267..aa6d14f977 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java @@ -10,10 +10,10 @@ import jakarta.persistence.criteria.Root; import org.hibernate.community.dialect.DerbyDialect; import org.hibernate.dialect.H2Dialect; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaRoot; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.orm.domain.gambit.BasicEntity; @@ -157,7 +157,7 @@ public class BasicCriteriaExecutionTests { final JpaCriteriaQuery criteria = criteriaBuilder.createQuery(); final JpaRoot root = criteria.from( BasicEntity.class ); - root.join( BasicEntity.class, SqmJoinType.CROSS ); + root.join( BasicEntity.class, JoinType.CROSS ); criteria.select( root ); session.createQuery( criteria ).list(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaGetJoinsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaGetJoinsTest.java index 4b615dbc87..a27e80eed5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaGetJoinsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/CriteriaGetJoinsTest.java @@ -9,7 +9,6 @@ import java.util.Set; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaQuery; import org.hibernate.query.criteria.JpaRoot; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.JiraKey; @@ -42,10 +41,10 @@ public class CriteriaGetJoinsTest { scope.inTransaction( session -> { HibernateCriteriaBuilder cb = session.getCriteriaBuilder(); - JpaCriteriaQuery cq = cb.createQuery(); + JpaCriteriaQuery cq = cb.createQuery(); JpaRoot root = cq.from( MyEntity.class ); root.join( "secondEntity", JoinType.LEFT ); - root.join( MyEntity.class, SqmJoinType.LEFT ); + root.join( MyEntity.class, org.hibernate.query.common.JoinType.LEFT ); Set> joins = root.getJoins(); /* SqmEntityJoin does not implement jakarta.persistence.criteria.Join, iterating through the @@ -53,7 +52,7 @@ public class CriteriaGetJoinsTest { */ assertThat( joins.size() ).isEqualTo( 1 ); - joins.forEach( join -> join.getJoinType() ); + joins.forEach( Join::getJoinType ); } ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DeleteJoinTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DeleteJoinTests.java index 22bda3acfb..536b481b2b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DeleteJoinTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DeleteJoinTests.java @@ -6,11 +6,11 @@ package org.hibernate.orm.test.query.hql; import java.time.LocalDate; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaDelete; import org.hibernate.query.criteria.JpaEntityJoin; import org.hibernate.query.criteria.JpaRoot; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.domain.StandardDomainModel; import org.hibernate.testing.orm.domain.contacts.Contact; @@ -80,7 +80,7 @@ public class DeleteJoinTests { final HibernateCriteriaBuilder cb = session.getCriteriaBuilder(); final JpaCriteriaDelete criteriaDelete = cb.createCriteriaDelete( BasicEntity.class ); final JpaRoot b = criteriaDelete.from( BasicEntity.class ); - final JpaEntityJoin c = b.join( Contact.class, SqmJoinType.LEFT ); + final JpaEntityJoin c = b.join( Contact.class, JoinType.LEFT ); c.on( b.get( "id" ).equalTo( c.get( "id" ) ) ); criteriaDelete.where( c.get( "id" ).isNotNull() ); int updated = session.createMutationQuery( criteriaDelete ).executeUpdate(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/UpdateJoinTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/UpdateJoinTests.java index e5ae135e00..b38f4103e6 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/UpdateJoinTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/UpdateJoinTests.java @@ -6,11 +6,11 @@ package org.hibernate.orm.test.query.hql; import java.time.LocalDate; +import org.hibernate.query.common.JoinType; import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.JpaCriteriaUpdate; import org.hibernate.query.criteria.JpaEntityJoin; import org.hibernate.query.criteria.JpaRoot; -import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.testing.orm.domain.StandardDomainModel; import org.hibernate.testing.orm.domain.contacts.Contact; @@ -81,7 +81,7 @@ public class UpdateJoinTests { final HibernateCriteriaBuilder cb = session.getCriteriaBuilder(); final JpaCriteriaUpdate criteriaUpdate = cb.createCriteriaUpdate( BasicEntity.class ); final JpaRoot b = criteriaUpdate.from( BasicEntity.class ); - final JpaEntityJoin c = b.join( Contact.class, SqmJoinType.LEFT ); + final JpaEntityJoin c = b.join( Contact.class, JoinType.LEFT ); c.on( b.get( "id" ).equalTo( c.get( "id" ) ) ); criteriaUpdate.set( b.get( "data" ), c.get( "name" ).get( "first" ) ); criteriaUpdate.where( c.get( "id" ).isNotNull() );