From 6787da71af08143f7b4a92a963d9515c75dd99e7 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Thu, 29 Aug 2024 23:33:55 +0200 Subject: [PATCH] HHH-18548 remove org.hibernate.annotations.QueryHints Signed-off-by: Gavin King --- .../org/hibernate/annotations/QueryHints.java | 109 ------------------ .../procedure/OracleStoredProcedureTest.java | 8 +- .../procedure/ProcedureParameterTests.java | 8 +- 3 files changed, 8 insertions(+), 117 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java b/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java deleted file mode 100644 index 05b61984e5..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/annotations/QueryHints.java +++ /dev/null @@ -1,109 +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.annotations; - -import org.hibernate.jpa.AvailableHints; -import org.hibernate.jpa.HibernateHints; -import org.hibernate.jpa.LegacySpecHints; -import org.hibernate.jpa.SpecHints; -import org.hibernate.query.Query; - -/** - * List of hints that may be passed to {@link jakarta.persistence.Query#setHint(String, Object)} - * to control execution of a query. Each of these hints corresponds to a typesafe operation of - * the {@link Query} interface, and so hints are only necessary for programs - * working with the JPA APIs. - * - * @see AvailableHints - * - * @deprecated Use {@link AvailableHints} instead - */ -@SuppressWarnings("unused") -@Deprecated(since = "6.0") -public final class QueryHints { - /** - * Disallow instantiation. - */ - private QueryHints() { - } - - /** - * @see HibernateHints#HINT_READ_ONLY - */ - public static final String READ_ONLY = HibernateHints.HINT_READ_ONLY; - - /** - * @see HibernateHints#HINT_CACHEABLE - */ - public static final String CACHEABLE = HibernateHints.HINT_CACHEABLE; - - /** - * @see HibernateHints#HINT_CACHE_MODE - */ - public static final String CACHE_MODE = HibernateHints.HINT_CACHE_MODE; - - /** - * @see HibernateHints#HINT_CACHE_REGION - */ - public static final String CACHE_REGION = HibernateHints.HINT_CACHE_REGION; - - /** - * @see HibernateHints#HINT_COMMENT - */ - public static final String COMMENT = HibernateHints.HINT_COMMENT; - - /** - * @see HibernateHints#HINT_FETCH_SIZE - */ - public static final String FETCH_SIZE = HibernateHints.HINT_FETCH_SIZE; - - /** - * @see HibernateHints#HINT_FLUSH_MODE - */ - public static final String FLUSH_MODE = HibernateHints.HINT_FLUSH_MODE; - - /** - * @see HibernateHints#HINT_TIMEOUT - */ - public static final String TIMEOUT_HIBERNATE = HibernateHints.HINT_TIMEOUT; - - /** - * @see org.hibernate.jpa.SpecHints#HINT_SPEC_QUERY_TIMEOUT - */ - public static final String TIMEOUT_JAKARTA_JPA = SpecHints.HINT_SPEC_QUERY_TIMEOUT; - - /** - * @see HibernateHints#HINT_NATIVE_LOCK_MODE - */ - public static final String NATIVE_LOCKMODE = HibernateHints.HINT_NATIVE_LOCK_MODE; - - /** - * @see HibernateHints#HINT_FOLLOW_ON_LOCKING - */ - public static final String FOLLOW_ON_LOCKING = HibernateHints.HINT_FOLLOW_ON_LOCKING; - - /** - * @see HibernateHints#HINT_NATIVE_SPACES - */ - public static final String NATIVE_SPACES = HibernateHints.HINT_NATIVE_SPACES; - - /** - * @see HibernateHints#HINT_CALLABLE_FUNCTION - * - * @deprecated Calling stored-procedures and functions via - * {@link org.hibernate.query.NativeQuery} is no longer supported. - * Use {@link org.hibernate.procedure.ProcedureCall} or - * {@link jakarta.persistence.StoredProcedureQuery} instead. - */ - @Deprecated(since="6") - public static final String CALLABLE_FUNCTION = HibernateHints.HINT_CALLABLE_FUNCTION; - - /** - * @see org.hibernate.jpa.SpecHints#HINT_SPEC_QUERY_TIMEOUT - */ - public static final String TIMEOUT_JPA = LegacySpecHints.HINT_JAVAEE_QUERY_TIMEOUT; -} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java index 378c3d89ab..36170d6e61 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/OracleStoredProcedureTest.java @@ -18,9 +18,9 @@ import java.time.ZoneOffset; import java.util.List; import org.hibernate.Session; -import org.hibernate.annotations.QueryHints; import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.OracleDialect; +import org.hibernate.jpa.HibernateHints; import org.hibernate.procedure.ProcedureCall; import org.hibernate.query.procedure.ProcedureParameter; import org.hibernate.result.Output; @@ -82,7 +82,7 @@ public class OracleStoredProcedureTest { public void testUnRegisteredParameter(EntityManagerFactoryScope scope) { scope.inTransaction( (em) -> { final StoredProcedureQuery function = em.createStoredProcedureQuery( "find_char", Integer.class ); - function.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + function.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-string function.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); // source-string @@ -101,7 +101,7 @@ public class OracleStoredProcedureTest { public void testUnRegisteredParameterByName2(EntityManagerFactoryScope scope) { scope.inTransaction( (em) -> { final StoredProcedureQuery function = em.createStoredProcedureQuery( "find_char", Integer.class ); - function.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + function.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-string function.registerStoredProcedureParameter( "search_char", String.class, ParameterMode.IN ); // source-string @@ -120,7 +120,7 @@ public class OracleStoredProcedureTest { public void testUnRegisteredParameterByNameInvertedParameterRegistrationOrder(EntityManagerFactoryScope scope) { scope.inTransaction( (em) -> { final StoredProcedureQuery function = em.createStoredProcedureQuery( "find_char", Integer.class ); - function.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + function.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-string function.registerStoredProcedureParameter( "string", String.class, ParameterMode.IN ); // source-string diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/ProcedureParameterTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/ProcedureParameterTests.java index b147067db5..2d605286bf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/ProcedureParameterTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/procedure/ProcedureParameterTests.java @@ -6,9 +6,9 @@ */ package org.hibernate.orm.test.procedure; -import org.hibernate.annotations.QueryHints; import org.hibernate.dialect.H2Dialect; +import org.hibernate.jpa.HibernateHints; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.JiraKey; import org.hibernate.testing.orm.junit.Jpa; @@ -41,7 +41,7 @@ public class ProcedureParameterTests { // registering and binding all 3 parameters scope.inTransaction( (em) -> { final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); - query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + query.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-tring query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); // source-string @@ -62,7 +62,7 @@ public class ProcedureParameterTests { scope.inTransaction( (em) -> { final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); - query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + query.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-string query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); // source-string @@ -86,7 +86,7 @@ public class ProcedureParameterTests { // function's default value defined on the database to be applied scope.inTransaction( (em) -> { final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); - query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); + query.setHint( HibernateHints.HINT_CALLABLE_FUNCTION, "true" ); // search-string query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); // source-string