public interface QueryProducer
Contract for things that can produce Query instances. Expected implementors include Session and StatelessSession. <p/> 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.
Modifier and Type | Method and Description |
---|---|
Query |
createNamedQuery(String name)
The JPA-defined named query creation method.
|
<R> Query<R> |
createNamedQuery(String name,
Class<R> resultClass)
The JPA-defined named, typed query creation method.
|
NativeQuery |
createNativeQuery(String sqlString)
Create a NativeQuery instance for the given native (SQL) query
|
<R> NativeQuery<R> |
createNativeQuery(String sqlString,
Class<R> resultClass)
Create a NativeQuery instance for the given native (SQL) query using
implicit mapping to the specified Java type.
|
NativeQuery |
createNativeQuery(String sqlString,
String resultSetMapping)
Create a NativeQuery instance for the given native (SQL) query using
implicit mapping to the specified Java type.
|
Query |
createQuery(String queryString)
Create a
Query instance for the given HQL/JPQL query string. |
<R> Query<R> |
createQuery(String queryString,
Class<R> resultClass)
Create a typed
Query instance for the given HQL/JPQL query string. |
default SQLQuery |
createSQLQuery(String queryString)
Deprecated.
(since 5.2) use
createNativeQuery(String) instead |
NativeQuery |
getNamedNativeQuery(String name)
Get a NativeQuery instance for a named native SQL query
|
Query |
getNamedQuery(String queryName)
Create a
Query instance for the named query. |
default Query |
getNamedSQLQuery(String name)
Deprecated.
(since 5.2) use
getNamedNativeQuery(String) instead |
Query getNamedQuery(String queryName)
Create a Query
instance for the named query.
queryName
- the name of a pre-defined, named queryIllegalArgumentException
- if a query has not been
defined with the given name or if the query string is
found to be invalidQuery createQuery(String queryString)
Create a Query
instance for the given HQL/JPQL query string.
queryString
- The HQL/JPQL queryEntityManager.createQuery(String)
<R> Query<R> createQuery(String queryString, Class<R> resultClass)
Create a typed Query
instance for the given HQL/JPQL query string.
queryString
- The HQL/JPQL queryEntityManager.createQuery(String,Class)
Query createNamedQuery(String name)
The JPA-defined named query creation method. This form can represent an HQL/JPQL query or a native query.
name
- the name of a pre-defined, named queryIllegalArgumentException
- if a query has not been
defined with the given name or if the query string is
found to be invalidEntityManager.createNamedQuery(String)
<R> Query<R> createNamedQuery(String name, Class<R> resultClass)
The JPA-defined named, typed query creation method. This form can only represent an HQL/JPQL query (not a native query).
name
- the name of a query defined in metadataresultClass
- the type of the query resultIllegalArgumentException
- 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 typeEntityManager.createNamedQuery(String,Class)
@Deprecated default SQLQuery createSQLQuery(String queryString)
createNativeQuery(String)
insteadCreate a NativeQuery
instance for the given SQL query string.
queryString
- The SQL queryNativeQuery createNativeQuery(String sqlString)
Create a NativeQuery instance for the given native (SQL) query
sqlString
- a native SQL query stringEntityManager.createNativeQuery(String)
<R> NativeQuery<R> createNativeQuery(String sqlString, Class<R> resultClass)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
sqlString
- Native (SQL) query stringresultClass
- The Java type to map results toEntityManager.createNativeQuery(String,Class)
NativeQuery createNativeQuery(String sqlString, String resultSetMapping)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.
sqlString
- Native (SQL) query stringresultSetMapping
- The explicit (named) result mappingEntityManager.createNativeQuery(String,Class)
,
SqlResultSetMapping
@Deprecated default Query getNamedSQLQuery(String name)
getNamedNativeQuery(String)
insteadGet a NativeQuery instance for a named native SQL query
name
- The name of the pre-defined queryNativeQuery getNamedNativeQuery(String name)
Get a NativeQuery instance for a named native SQL query
name
- The name of the pre-defined queryCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.