Package org.hibernate.query
Interface QueryProducer
-
- All Known Subinterfaces:
EventSource
,HibernateEntityManager
,HibernateEntityManager
,HibernateEntityManagerImplementor
,QueryProducerImplementor
,Session
,SessionImplementor
,SharedSessionContract
,SharedSessionContractImplementor
,StatelessSession
- All Known Implementing Classes:
SessionDelegatorBaseImpl
,SessionLazyDelegator
public interface QueryProducer
Contract for things that can produce Query instances. Expected implementors include Session and StatelessSession. It defines these query creation methods in the signature defined by EntityManager. In a way it defines a subset of the EntityManager contract to be reused by both Session and StatelessSession.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Query
createNamedQuery(java.lang.String name)
The JPA-defined named query creation method.<R> Query<R>
createNamedQuery(java.lang.String name, java.lang.Class<R> resultClass)
The JPA-defined named, typed query creation method.NativeQuery
createNativeQuery(java.lang.String sqlString)
Create a NativeQuery instance for the given native (SQL) query<R> NativeQuery<R>
createNativeQuery(java.lang.String sqlString, java.lang.Class<R> resultClass)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.NativeQuery
createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.Query
createQuery(java.lang.String queryString)
Create aQuery
instance for the given HQL/JPQL query string.<R> Query<R>
createQuery(java.lang.String queryString, java.lang.Class<R> resultClass)
Create a typedQuery
instance for the given HQL/JPQL query string.Query
createQuery(CriteriaDelete deleteQuery)
<T> Query<T>
createQuery(CriteriaQuery<T> criteriaQuery)
Query
createQuery(CriteriaUpdate updateQuery)
default SQLQuery
createSQLQuery(java.lang.String queryString)
Deprecated.(since 5.2) usecreateNativeQuery(String)
insteadNativeQuery
getNamedNativeQuery(java.lang.String name)
Get a NativeQuery instance for a named native SQL queryQuery
getNamedQuery(java.lang.String queryName)
Create aQuery
instance for the named query.default Query
getNamedSQLQuery(java.lang.String name)
Deprecated.(since 5.2) usegetNamedNativeQuery(String)
instead
-
-
-
Method Detail
-
getNamedQuery
Query getNamedQuery(java.lang.String queryName)
Create aQuery
instance for the named query.- Parameters:
queryName
- the name of a pre-defined, named query- Returns:
- The Query instance for manipulation and execution
- Throws:
java.lang.IllegalArgumentException
- if a query has not been defined with the given name or if the query string is found to be invalid
-
createQuery
Query createQuery(java.lang.String queryString)
Create aQuery
instance for the given HQL/JPQL query string.- Parameters:
queryString
- The HQL/JPQL query- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createQuery(String)
-
createQuery
<R> Query<R> createQuery(java.lang.String queryString, java.lang.Class<R> resultClass)
Create a typedQuery
instance for the given HQL/JPQL query string.- Parameters:
queryString
- The HQL/JPQL queryresultClass
- The type of the query result- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createQuery(String,Class)
-
createNamedQuery
Query createNamedQuery(java.lang.String name)
The JPA-defined named query creation method. This form can represent an HQL/JPQL query or a native query.- Parameters:
name
- the name of a pre-defined, named query- Returns:
- The Query instance for manipulation and execution
- Throws:
java.lang.IllegalArgumentException
- if a query has not been defined with the given name or if the query string is found to be invalid- See Also:
EntityManager.createNamedQuery(String)
-
createNamedQuery
<R> Query<R> createNamedQuery(java.lang.String name, java.lang.Class<R> resultClass)
The JPA-defined named, typed query creation method. This form can only represent an HQL/JPQL query (not a native query).- Parameters:
name
- the name of a query defined in metadataresultClass
- the type of the query result- Returns:
- The Query instance for manipulation and execution
- Throws:
java.lang.IllegalArgumentException
- if a query has not been defined with the given name or if the query string is found to be invalid or if the query result is found to not be assignable to the specified type- See Also:
EntityManager.createNamedQuery(String,Class)
-
createSQLQuery
@Deprecated default SQLQuery createSQLQuery(java.lang.String queryString)
Deprecated.(since 5.2) usecreateNativeQuery(String)
insteadCreate aNativeQuery
instance for the given SQL query string.- Parameters:
queryString
- The SQL query- Returns:
- The query instance for manipulation and execution
-
createNativeQuery
NativeQuery createNativeQuery(java.lang.String sqlString)
Create a NativeQuery instance for the given native (SQL) query- Parameters:
sqlString
- a native SQL query string- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String)
-
createNativeQuery
<R> NativeQuery<R> createNativeQuery(java.lang.String sqlString, java.lang.Class<R> resultClass)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.- Parameters:
sqlString
- Native (SQL) query stringresultClass
- The Java entity type to map results to- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String,Class)
-
createNativeQuery
NativeQuery createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.- Parameters:
sqlString
- Native (SQL) query stringresultSetMapping
- The explicit (named) result mapping- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String,Class)
,SqlResultSetMapping
-
getNamedSQLQuery
@Deprecated default Query getNamedSQLQuery(java.lang.String name)
Deprecated.(since 5.2) usegetNamedNativeQuery(String)
insteadGet a NativeQuery instance for a named native SQL query- Parameters:
name
- The name of the pre-defined query- Returns:
- The NativeQuery instance for manipulation and execution
-
getNamedNativeQuery
NativeQuery getNamedNativeQuery(java.lang.String name)
Get a NativeQuery instance for a named native SQL query- Parameters:
name
- The name of the pre-defined query- Returns:
- The NativeQuery instance for manipulation and execution
-
createQuery
<T> Query<T> createQuery(CriteriaQuery<T> criteriaQuery)
-
createQuery
Query createQuery(CriteriaUpdate updateQuery)
-
createQuery
Query createQuery(CriteriaDelete deleteQuery)
-
-