mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 16:15:06 +00:00
HHH-17797 support query hint database indexes
This commit is contained in:
parent
096b667520
commit
d21ddf31e5
@ -223,4 +223,14 @@ public interface HibernateHints {
|
||||
* @since 6.3
|
||||
*/
|
||||
String HINT_QUERY_PLAN_CACHEABLE = "hibernate.query.plan.cacheable";
|
||||
|
||||
/**
|
||||
* Hint for specifying a query hint to be appended to the
|
||||
* SQL statement sent to the database.
|
||||
*
|
||||
* @see org.hibernate.query.spi.MutableQueryOptions#addDatabaseHint(String)
|
||||
* @see org.hibernate.query.Query#addQueryHint
|
||||
* @since 6.5
|
||||
*/
|
||||
String HINT_QUERY_DATABASE = "hibernate.query.database";
|
||||
}
|
||||
|
@ -71,6 +71,7 @@
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_FLUSH_MODE;
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_FOLLOW_ON_LOCKING;
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_NATIVE_SPACES;
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_QUERY_DATABASE;
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_QUERY_PLAN_CACHEABLE;
|
||||
import static org.hibernate.jpa.HibernateHints.HINT_TIMEOUT;
|
||||
import static org.hibernate.jpa.LegacySpecHints.HINT_JAVAEE_CACHE_RETRIEVE_MODE;
|
||||
@ -270,6 +271,9 @@ public final boolean applyHint(String hintName, Object value) {
|
||||
case HINT_NATIVE_SPACES:
|
||||
applySynchronizeSpacesHint( value );
|
||||
return true;
|
||||
case HINT_QUERY_DATABASE:
|
||||
applyDatabaseHint( (String) value );
|
||||
return true;
|
||||
default:
|
||||
if ( applySelectionHint( hintName, value ) || applyAdditionalPossibleHints( hintName, value ) ) {
|
||||
return true;
|
||||
@ -547,6 +551,9 @@ protected void applyFlushModeHint(FlushMode flushMode) {
|
||||
setHibernateFlushMode( flushMode );
|
||||
}
|
||||
|
||||
protected void applyDatabaseHint(String hint) {
|
||||
getQueryOptions().addDatabaseHint( hint );
|
||||
}
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Options
|
||||
|
Loading…
x
Reference in New Issue
Block a user