HHH-18548 remove org.hibernate.annotations.QueryHints

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-08-29 23:33:55 +02:00
parent ad6f326090
commit 6787da71af
3 changed files with 8 additions and 117 deletions

View File

@ -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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
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;
}

View File

@ -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

View File

@ -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