接口 QueryProducer
-
- 所有已知子接口:
EventSource,HibernateEntityManager,HibernateEntityManager,HibernateEntityManagerImplementor,QueryProducerImplementor,Session,SessionImplementor,SharedSessionContract,SharedSessionContractImplementor,StatelessSession
- 所有已知实现类:
AbstractSessionImpl,AbstractSharedSessionContract,SessionDelegatorBaseImpl,SessionImpl,StatelessSessionImpl
public interface QueryProducerContract 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.- 作者:
- Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 默认方法 已过时的方法 修饰符和类型 方法 说明 QuerycreateNamedQuery(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.NativeQuerycreateNativeQuery(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.NativeQuerycreateNativeQuery(String sqlString, String resultSetMapping)Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.QuerycreateQuery(String queryString)Create aQueryinstance for the given HQL/JPQL query string.<R> Query<R>createQuery(String queryString, Class<R> resultClass)Create a typedQueryinstance for the given HQL/JPQL query string.QuerycreateQuery(javax.persistence.criteria.CriteriaDelete deleteQuery)<T> Query<T>createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)QuerycreateQuery(javax.persistence.criteria.CriteriaUpdate updateQuery)default SQLQuerycreateSQLQuery(String queryString)已过时。(since 5.2) usecreateNativeQuery(String)insteadNativeQuerygetNamedNativeQuery(String name)Get a NativeQuery instance for a named native SQL queryQuerygetNamedQuery(String queryName)Create aQueryinstance for the named query.default QuerygetNamedSQLQuery(String name)已过时。(since 5.2) usegetNamedNativeQuery(String)instead
-
-
-
方法详细资料
-
getNamedQuery
Query getNamedQuery(String queryName)
Create aQueryinstance for the named query.- 参数:
queryName- the name of a pre-defined, named query- 返回:
- The Query instance for manipulation and execution
- 抛出:
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(String queryString)
Create aQueryinstance for the given HQL/JPQL query string.- 参数:
queryString- The HQL/JPQL query- 返回:
- The Query instance for manipulation and execution
- 另请参阅:
EntityManager.createQuery(String)
-
createQuery
<R> Query<R> createQuery(String queryString, Class<R> resultClass)
Create a typedQueryinstance for the given HQL/JPQL query string.- 参数:
queryString- The HQL/JPQL query- 返回:
- The Query instance for manipulation and execution
- 另请参阅:
EntityManager.createQuery(String,Class)
-
createNamedQuery
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 query- 返回:
- The Query instance for manipulation and execution
- 抛出:
IllegalArgumentException- if a query has not been defined with the given name or if the query string is found to be invalid- 另请参阅:
EntityManager.createNamedQuery(String)
-
createNamedQuery
<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 result- 返回:
- The Query instance for manipulation and execution
- 抛出:
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- 另请参阅:
EntityManager.createNamedQuery(String,Class)
-
createSQLQuery
@Deprecated default SQLQuery createSQLQuery(String queryString)
已过时。(since 5.2) usecreateNativeQuery(String)insteadCreate aNativeQueryinstance for the given SQL query string.- 参数:
queryString- The SQL query- 返回:
- The query instance for manipulation and execution
-
createNativeQuery
NativeQuery createNativeQuery(String sqlString)
Create a NativeQuery instance for the given native (SQL) query- 参数:
sqlString- a native SQL query string- 返回:
- The NativeQuery instance for manipulation and execution
- 另请参阅:
EntityManager.createNativeQuery(String)
-
createNativeQuery
<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 to- 返回:
- The NativeQuery instance for manipulation and execution
- 另请参阅:
EntityManager.createNativeQuery(String,Class)
-
createNativeQuery
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 mapping- 返回:
- The NativeQuery instance for manipulation and execution
- 另请参阅:
EntityManager.createNativeQuery(String,Class),SqlResultSetMapping
-
getNamedSQLQuery
@Deprecated default Query getNamedSQLQuery(String name)
已过时。(since 5.2) usegetNamedNativeQuery(String)insteadGet a NativeQuery instance for a named native SQL query- 参数:
name- The name of the pre-defined query- 返回:
- The NativeQuery instance for manipulation and execution
-
getNamedNativeQuery
NativeQuery getNamedNativeQuery(String name)
Get a NativeQuery instance for a named native SQL query- 参数:
name- The name of the pre-defined query- 返回:
- The NativeQuery instance for manipulation and execution
-
createQuery
<T> Query<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
-
createQuery
Query createQuery(javax.persistence.criteria.CriteriaUpdate updateQuery)
-
createQuery
Query createQuery(javax.persistence.criteria.CriteriaDelete deleteQuery)
-
-