Top Description Methods
org.hibernate.query.spi

public Interface QueryProducerImplementor

extends QueryProducer
Known Direct Subinterfaces
org.hibernate.engine.spi.SharedSessionContractImplementor
Imports
org.hibernate.CacheMode, .FlushMode, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.query.MutationQuery, .QueryProducer, org.hibernate.query.sql.spi.NativeQueryImplementor, jakarta.persistence.criteria.CriteriaDelete, .CriteriaQuery, .CriteriaUpdate

The internal contract for QueryProducer implementations. Acts as the value passed to produced queries and provides them with access to needed functionality.
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public MutationQuery
createMutationQuery(String statementString)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery reference for the given HQL insert, update, or delete statement.
public MutationQuery
createMutationQuery(CriteriaUpdate<T> updateQuery)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given update criteria tree
public MutationQuery
createMutationQuery(CriteriaDelete<T> deleteQuery)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given delete criteria tree
public MutationQuery
createNamedMutationQuery(String name)

Redeclares org.hibernate.query.QueryProducer.createNamedMutationQuery.

Create a MutationQuery instance for the given named insert, update, or delete HQL query.
public QueryImplementor<R>
createNamedQuery(String
the name of a predefined named query
name
)

Redeclares org.hibernate.query.QueryProducer.createNamedQuery.

Deprecated
Create a typed Query instance for the given named query.
public <R> QueryImplementor<R>
createNamedQuery(String
the name of a query defined in metadata
name
,
Class<R>
the type of the query result
resultClass
)

Redeclares org.hibernate.query.QueryProducer.createNamedQuery.

Create a typed Query instance for the given named query.
public MutationQuery
createNativeMutationQuery(String
a native SQL statement string
sqlString
)

Redeclares org.hibernate.query.QueryProducer.createNativeMutationQuery.

Create a NativeQuery instance for the given native SQL statement.
public NativeQueryImplementor<R>
createNativeQuery(String
a native SQL query string
sqlString
)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Deprecated
Create a NativeQuery instance for the given native SQL query.
public <R> NativeQueryImplementor<R>
createNativeQuery(String
The native (SQL) query string
sqlString
,
Class<R>
The Java type to map results to
resultClass
)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an implicit mapping to the specified Java type.
public <R> NativeQueryImplementor<R>
createNativeQuery(String
Native (SQL) query string
sqlString
,
Class<R>
The Java entity class to map results to
resultClass
,
String
The table alias for columns in the result set
tableAlias
)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an implicit mapping to the specified Java entity type.
public NativeQueryImplementor<R>
createNativeQuery(String
The native (SQL) query string
sqlString
,
String
The explicit result mapping name
resultSetMappingName
)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Deprecated
Create a NativeQuery instance for the given native SQL query using an explicit mapping to the specified Java type.
public <R> NativeQueryImplementor<R>
createNativeQuery(String
The native (SQL) query string
sqlString
,
String
The explicit result mapping name
resultSetMappingName
,
Class<R> resultClass)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an explicit mapping to the specified Java type.
public QueryImplementor<R>
createQuery(String
The HQL query
queryString
)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Deprecated
Create a Query instance for the given HQL query, or HQL insert, update, or delete statement.
public <R> QueryImplementor<R>
createQuery(String
The HQL query
queryString
,
Class<R>
The type of the query result
resultClass
)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Create a typed Query instance for the given HQL query string and given query result type.
public <R> QueryImplementor<R>
createQuery(CriteriaQuery<R> criteriaQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Create a Query for the given JPA CriteriaQuery.
public QueryImplementor<R>
createQuery(CriteriaUpdate<T> updateQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Deprecated
Create a MutationQuery for the given JPA CriteriaUpdate
public QueryImplementor<R>
createQuery(CriteriaDelete<T> deleteQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Deprecated
Create a MutationQuery for the given JPA CriteriaDelete
public CacheMode
public SessionFactoryImplementor
getFactory()

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public FlushMode
public NativeQueryImplementor<R>
getNamedNativeQuery(String
The name of the predefined query
name
)

Redeclares org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated
Get a NativeQuery instance for a named native SQL query
public NativeQueryImplementor<R>
getNamedNativeQuery(String
The name of the predefined query
name
,
String resultSetMapping)

Redeclares org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated
Get a NativeQuery instance for a named native SQL query
public QueryImplementor<R>
getNamedQuery(String
the name of a predefined named query
queryName
)

Redeclares org.hibernate.query.QueryProducer.getNamedQuery.

Create a Query instance for the named query.
Inherited from org.hibernate.query.QueryProducer:
createMutationQuerycreateNamedSelectionQuerycreateNamedSelectionQuerycreateSelectionQuerycreateSelectionQuerycreateSelectionQuery

Method Detail

createMutationQueryback to summary
public MutationQuery createMutationQuery(String statementString)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Doc from org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery reference for the given HQL insert, update, or delete statement.

Annotations
@Override
createMutationQueryback to summary
public MutationQuery createMutationQuery(CriteriaUpdate<T> updateQuery)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Doc from org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given update criteria tree

Annotations
@Override
createMutationQueryback to summary
public MutationQuery createMutationQuery(CriteriaDelete<T> deleteQuery)

Redeclares org.hibernate.query.QueryProducer.createMutationQuery.

Doc from org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given delete criteria tree

Annotations
@Override
createNamedMutationQueryback to summary
public MutationQuery createNamedMutationQuery(String name)

Redeclares org.hibernate.query.QueryProducer.createNamedMutationQuery.

Doc from org.hibernate.query.QueryProducer.createNamedMutationQuery.

Create a MutationQuery instance for the given named insert, update, or delete HQL query. The named query might be defined as HQL) or native-SQL.

Annotations
@Override
createNamedQueryback to summary
public QueryImplementor<R> createNamedQuery(String name)

Redeclares org.hibernate.query.QueryProducer.createNamedQuery.

Doc from org.hibernate.query.QueryProducer.createNamedQuery.

Deprecated

Create a typed Query instance for the given named query. The named query might be defined in HQL or in native SQL.

Parameters
name:String

the name of a predefined named query

Returns:QueryImplementor<R>

The Query instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
createNamedQueryback to summary
public <R> QueryImplementor<R> createNamedQuery(String name, Class<R> resultClass)

Redeclares org.hibernate.query.QueryProducer.createNamedQuery.

Doc from org.hibernate.query.QueryProducer.createNamedQuery.

Create a typed Query instance for the given named query. The named query might be defined in HQL or in native SQL.

Parameters
name:String

the name of a query defined in metadata

resultClass:Class<R>

the type of the query result

Returns:QueryImplementor<R>

The Query instance for manipulation and execution

Annotations
@Override
createNativeMutationQueryback to summary
public MutationQuery createNativeMutationQuery(String sqlString)

Redeclares org.hibernate.query.QueryProducer.createNativeMutationQuery.

Doc from org.hibernate.query.QueryProducer.createNativeMutationQuery.

Create a NativeQuery instance for the given native SQL statement.

Parameters
sqlString:String

a native SQL statement string

Returns:MutationQuery

The NativeQuery instance for manipulation and execution

Annotations
@Override
createNativeQueryback to summary
public NativeQueryImplementor<R> createNativeQuery(String sqlString)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Doc from org.hibernate.query.QueryProducer.createNativeQuery.

Deprecated

Create a NativeQuery instance for the given native SQL query.

Parameters
sqlString:String

a native SQL query string

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
createNativeQueryback to summary
public <R> NativeQueryImplementor<R> createNativeQuery(String sqlString, Class<R> resultClass)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Doc from org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an implicit mapping to the specified Java type.

  • If the given class is an entity class, this method is equivalent to createNativeQuery(sqlString).addEntity(resultClass).
  • If the given class has a registered org.hibernate.type.descriptor.java.JavaType, then the query must return a result set with a single column whose JdbcType is compatible with that JavaType.
  • Otherwise, the select items will be packaged into an instance of the result type. The result type must have an appropriate constructor with parameter types matching the select items, or it must be one of the types Object[], java.util.List, java.util.Map, or jakarta.persistence.Tuple.
Parameters
sqlString:String

The native (SQL) query string

resultClass:Class<R>

The Java type to map results to

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
createNativeQueryback to summary
public <R> NativeQueryImplementor<R> createNativeQuery(String sqlString, Class<R> resultClass, String tableAlias)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Doc from org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an implicit mapping to the specified Java entity type.

The given class must be an entity class. This method is equivalent to createNativeQuery(sqlString).addEntity(tableAlias, resultClass).

Parameters
sqlString:String

Native (SQL) query string

resultClass:Class<R>

The Java entity class to map results to

tableAlias:String

The table alias for columns in the result set

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
createNativeQueryback to summary
public NativeQueryImplementor<R> createNativeQuery(String sqlString, String resultSetMappingName)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Doc from org.hibernate.query.QueryProducer.createNativeQuery.

Deprecated

Create a NativeQuery instance for the given native SQL query using an explicit mapping to the specified Java type.

The given result set mapping name must identify a mapping defined by a jakarta.persistence.SqlResultSetMapping annotation.

Parameters
sqlString:String

The native (SQL) query string

resultSetMappingName:String

The explicit result mapping name

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
createNativeQueryback to summary
public <R> NativeQueryImplementor<R> createNativeQuery(String sqlString, String resultSetMappingName, Class<R> resultClass)

Redeclares org.hibernate.query.QueryProducer.createNativeQuery.

Doc from org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an explicit mapping to the specified Java type.

The given result set mapping name must identify a mapping defined by a jakarta.persistence.SqlResultSetMapping annotation.

Parameters
sqlString:String

The native (SQL) query string

resultSetMappingName:String

The explicit result mapping name

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
createQueryback to summary
public QueryImplementor<R> createQuery(String queryString)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Doc from org.hibernate.query.QueryProducer.createQuery.

Deprecated

Create a Query instance for the given HQL query, or HQL insert, update, or delete statement.

If a query has no explicit select list, the select list is inferred:

  • if there is exactly one root entity in the from clause, then that root entity is the only element of the select list, or
  • otherwise, if there are multiple root entities in the from clause, then the select list contains every root entity and every non-fetch joined entity.
Parameters
queryString:String

The HQL query

Returns:QueryImplementor<R>

The Query instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
createQueryback to summary
public <R> QueryImplementor<R> createQuery(String queryString, Class<R> resultClass)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Doc from org.hibernate.query.QueryProducer.createQuery.

Create a typed Query instance for the given HQL query string and given query result type.

  • If the query has a single item in the select list, then the select item must be assignable to the given result type.
  • Otherwise, if there are multiple select items, then the select items will be packaged into an instance of the result type. The result type must have an appropriate constructor with parameter types matching the select items, or it must be one of the types Object[], java.util.List, java.util.Map, or jakarta.persistence.Tuple.

If a query has no explicit select list, the select list is inferred from the given query result type:

  • if the result type is an entity type, the query must have exactly one root entity in the from clause, it must be assignable to the result type, and the inferred select list will contain just that entity, or
  • otherwise, the select list contains every root entity and every non-fetch joined entity, and each query result will be packaged into an instance of the result type, just as specified above.

The returned Query may be executed by calling Query#getResultList() or Query#getSingleResult().

Parameters
queryString:String

The HQL query

resultClass:Class<R>

The type of the query result

Returns:QueryImplementor<R>

The Query instance for manipulation and execution

Annotations
@Override
createQueryback to summary
public <R> QueryImplementor<R> createQuery(CriteriaQuery<R> criteriaQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Doc from org.hibernate.query.QueryProducer.createQuery.

Create a Query for the given JPA CriteriaQuery.

Annotations
@Override
createQueryback to summary
public QueryImplementor<R> createQuery(CriteriaUpdate<T> updateQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Doc from org.hibernate.query.QueryProducer.createQuery.

Deprecated

Create a MutationQuery for the given JPA CriteriaUpdate

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
createQueryback to summary
public QueryImplementor<R> createQuery(CriteriaDelete<T> deleteQuery)

Redeclares org.hibernate.query.QueryProducer.createQuery.

Doc from org.hibernate.query.QueryProducer.createQuery.

Deprecated

Create a MutationQuery for the given JPA CriteriaDelete

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
getCacheModeback to summary
public CacheMode getCacheMode()
getFactoryback to summary
public SessionFactoryImplementor getFactory()

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

getHibernateFlushModeback to summary
public FlushMode getHibernateFlushMode()
getNamedNativeQueryback to summary
public NativeQueryImplementor<R> getNamedNativeQuery(String name)

Redeclares org.hibernate.query.QueryProducer.getNamedNativeQuery.

Doc from org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated

Get a NativeQuery instance for a named native SQL query

Parameters
name:String

The name of the predefined query

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
getNamedNativeQueryback to summary
public NativeQueryImplementor<R> getNamedNativeQuery(String name, String resultSetMapping)

Redeclares org.hibernate.query.QueryProducer.getNamedNativeQuery.

Doc from org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated

Get a NativeQuery instance for a named native SQL query

Parameters
name:String

The name of the predefined query

Returns:NativeQueryImplementor<R>

The NativeQuery instance for manipulation and execution

Annotations
@Override
@Deprecated
@SuppressWarnings:rawtypes
getNamedQueryback to summary
public QueryImplementor<R> getNamedQuery(String queryName)

Redeclares org.hibernate.query.QueryProducer.getNamedQuery.

Doc from org.hibernate.query.QueryProducer.getNamedQuery.

Create a Query instance for the named query.

Parameters
queryName:String

the name of a predefined named query

Returns:QueryImplementor<R>

The Query instance for manipulation and execution

Annotations
@Override
@SuppressWarnings:rawtypes