Package org.hibernate.reactive.stage
Interface Stage.QueryProducer
- All Known Subinterfaces:
Stage.Session
,Stage.StatelessSession
- Enclosing interface:
- Stage
public static interface Stage.QueryProducer
Operations common to objects which act as factories for instances of
Stage.Query
. This is a common supertype of Stage.Session
and
Stage.StatelessSession
.- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescription<T> jakarta.persistence.EntityGraph<T>
createEntityGraph
(Class<T> rootType) Create a new mutableEntityGraph
<T> jakarta.persistence.EntityGraph<T>
createEntityGraph
(Class<T> rootType, String graphName) Create a new mutable copy of a namedEntityGraph
createMutationQuery
(jakarta.persistence.criteria.CriteriaDelete<?> deleteQuery) Create an instance ofStage.MutationQuery
for the given delete tree.createMutationQuery
(jakarta.persistence.criteria.CriteriaUpdate<?> updateQuery) Create an instance ofStage.MutationQuery
for the given update tree.createMutationQuery
(String queryString) Create an instance ofStage.MutationQuery
for the given HQL/JPQL update or delete statement.createMutationQuery
(JpaCriteriaInsert<?> insert) Create aStage.MutationQuery
from the given insert select criteria tree<R> Stage.Query<R>
createNamedQuery
(String queryName) Create an instance ofStage.Query
for the named query.<R> Stage.SelectionQuery<R>
createNamedQuery
(String queryName, Class<R> resultType) Create an instance ofStage.SelectionQuery
for the named query.<R> Stage.Query<R>
createNativeQuery
(String queryString) Create an instance ofStage.Query
for the given SQL query string, or SQL update, insert, or delete statement.<R> Stage.SelectionQuery<R>
createNativeQuery
(String queryString, Class<R> resultType) Create an instance ofStage.Query
for the given SQL query string, using the givenresultType
to interpret the results.<R> Stage.SelectionQuery<R>
createNativeQuery
(String queryString, Class<R> resultType, AffectedEntities affectedEntities) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenresultType
to interpret the results.<R> Stage.Query<R>
createNativeQuery
(String queryString, AffectedEntities affectedEntities) Create an instance ofStage.Query
for the given SQL query string, or SQL update, insert, or delete statement.<R> Stage.SelectionQuery<R>
createNativeQuery
(String queryString, ResultSetMapping<R> resultSetMapping) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenResultSetMapping
to interpret the result set.<R> Stage.SelectionQuery<R>
createNativeQuery
(String queryString, ResultSetMapping<R> resultSetMapping, AffectedEntities affectedEntities) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenResultSetMapping
to interpret the result set.createQuery
(jakarta.persistence.criteria.CriteriaDelete<R> criteriaDelete) Create an instance ofStage.MutationQuery
for the given criteria delete.<R> Stage.SelectionQuery<R>
createQuery
(jakarta.persistence.criteria.CriteriaQuery<R> criteriaQuery) Create an instance ofStage.SelectionQuery
for the given criteria query.createQuery
(jakarta.persistence.criteria.CriteriaUpdate<R> criteriaUpdate) Create an instance ofStage.MutationQuery
for the given criteria update.<R> Stage.Query<R>
createQuery
(jakarta.persistence.TypedQueryReference<R> typedQueryReference) Create a typedStage.Query
instance for the given typed query reference.<R> Stage.Query<R>
createQuery
(String queryString) Deprecated.<R> Stage.SelectionQuery<R>
createQuery
(String queryString, Class<R> resultType) Create an instance ofStage.SelectionQuery
for the given HQL/JPQL query string and query result type.<R> Stage.SelectionQuery<R>
createSelectionQuery
(String queryString, Class<R> resultType) Create an instance ofStage.SelectionQuery
for the given HQL/JPQL query string.jakarta.persistence.criteria.CriteriaBuilder
Convenience method to obtain theCriteriaBuilder
.<T> jakarta.persistence.EntityGraph<T>
getEntityGraph
(Class<T> rootType, String graphName) Obtain a namedEntityGraph
<T> ResultSetMapping<T>
getResultSetMapping
(Class<T> resultType, String mappingName) Obtain a native SQL result set mapping defined via the annotationSqlResultSetMapping
.
-
Method Details
-
createSelectionQuery
Create an instance ofStage.SelectionQuery
for the given HQL/JPQL query string.- Parameters:
queryString
- The HQL/JPQL query- Returns:
- The
Stage.SelectionQuery
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String, Class)
-
createMutationQuery
Create an instance ofStage.MutationQuery
for the given HQL/JPQL update or delete statement.- Parameters:
queryString
- The HQL/JPQL query, update or delete statement- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String)
-
createMutationQuery
Create an instance ofStage.MutationQuery
for the given update tree.- Parameters:
updateQuery
- the update criteria query- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution - See Also:
-
createMutationQuery
Create an instance ofStage.MutationQuery
for the given delete tree.- Parameters:
deleteQuery
- the delete criteria query- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution - See Also:
-
createMutationQuery
Create aStage.MutationQuery
from the given insert select criteria tree- Parameters:
insert
- the insert select criteria query- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution - See Also:
-
createQuery
Create a typedStage.Query
instance for the given typed query reference.- Parameters:
typedQueryReference
- the type query reference- Returns:
- The
Stage.Query
instance for execution - Throws:
IllegalArgumentException
- if a query has not been defined with the name of the typed query reference or if the query result is found to not be assignable to result class of the typed query reference- See Also:
-
createQuery
Deprecated.See explanation inQueryProducer.createSelectionQuery(String)
Create an instance ofStage.Query
for the given HQL/JPQL query string or HQL/JPQL update or delete statement. In the case of an update or delete, the returnedStage.Query
must be executed usingStage.MutationQuery.executeUpdate()
which returns an affected row count.- Parameters:
queryString
- The HQL/JPQL query, update or delete statement- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String)
-
createQuery
Create an instance ofStage.SelectionQuery
for the given HQL/JPQL query string and query result type.- Parameters:
queryString
- The HQL/JPQL queryresultType
- the Java type returned in each row of query results- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String, Class)
-
createQuery
Create an instance ofStage.MutationQuery
for the given criteria update.- Parameters:
criteriaUpdate
- TheCriteriaUpdate
- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution
-
createQuery
Create an instance ofStage.MutationQuery
for the given criteria delete.- Parameters:
criteriaDelete
- TheCriteriaDelete
- Returns:
- The
Stage.MutationQuery
instance for manipulation and execution
-
createNamedQuery
Create an instance ofStage.Query
for the named query.- Parameters:
queryName
- The name of the query- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String)
-
createNamedQuery
Create an instance ofStage.SelectionQuery
for the named query.- Parameters:
queryName
- The name of the queryresultType
- the Java type returned in each row of query results- Returns:
- The
Stage.SelectionQuery
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String, Class)
-
createNativeQuery
Create an instance ofStage.Query
for the given SQL query string, using the givenresultType
to interpret the results.- If the given result type is
Object
, or a built-in type such asString
orInteger
, the result set must have a single column, which will be returned as a scalar. - If the given result type is
Object[]
, then the result set must have multiple columns, which will be returned as elements of arrays of typeObject[]
. - Otherwise, the given result type must be an entity class, in which case the result set column aliases must map to the fields of the entity, and the query will return instances of the entity.
- Parameters:
queryString
- The SQL queryresultType
- the Java type returned in each row of query results- Returns:
- The
Stage.SelectionQuery
instance for manipulation and execution - See Also:
-
EntityManager.createNativeQuery(String, Class)
- If the given result type is
-
createNativeQuery
<R> Stage.SelectionQuery<R> createNativeQuery(String queryString, Class<R> resultType, AffectedEntities affectedEntities) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenresultType
to interpret the results.- If the given result type is
Object
, or a built-in type such asString
orInteger
, the result set must have a single column, which will be returned as a scalar. - If the given result type is
Object[]
, then the result set must have multiple columns, which will be returned as elements of arrays of typeObject[]
. - Otherwise, the given result type must be an entity class, in which case the result set column aliases must map to the fields of the entity, and the query will return instances of the entity.
affected entities
are synchronized with the database before execution of the query.- Parameters:
queryString
- The SQL queryresultType
- the Java type returned in each row of query resultsaffectedEntities
- The entities which are affected by the query- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
EntityManager.createNativeQuery(String, Class)
- If the given result type is
-
createNativeQuery
<R> Stage.SelectionQuery<R> createNativeQuery(String queryString, ResultSetMapping<R> resultSetMapping) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenResultSetMapping
to interpret the result set.- Parameters:
queryString
- The SQL queryresultSetMapping
- the result set mapping- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
getResultSetMapping(Class, String)
EntityManager.createNativeQuery(String, String)
-
createNativeQuery
<R> Stage.SelectionQuery<R> createNativeQuery(String queryString, ResultSetMapping<R> resultSetMapping, AffectedEntities affectedEntities) Create an instance ofStage.SelectionQuery
for the given SQL query string, using the givenResultSetMapping
to interpret the result set.Any
affected entities
are synchronized with the database before execution of the query.- Parameters:
queryString
- The SQL queryresultSetMapping
- the result set mappingaffectedEntities
- The entities which are affected by the query- Returns:
- The
Stage.Query
instance for manipulation and execution - See Also:
-
getResultSetMapping(Class, String)
EntityManager.createNativeQuery(String, String)
-
createNativeQuery
Create an instance ofStage.Query
for the given SQL query string, or SQL update, insert, or delete statement. In the case of an update, insert, or delete, the returnedStage.Query
must be executed usingStage.MutationQuery.executeUpdate()
which returns an affected row count. In the case of a query:- If the result set has a single column, the results will be returned as scalars.
- Otherwise, if the result set has multiple columns, the results will
be returned as elements of arrays of type
Object[]
.
- Parameters:
queryString
- The SQL select, update, insert, or delete statement
-
createNativeQuery
Create an instance ofStage.Query
for the given SQL query string, or SQL update, insert, or delete statement. In the case of an update, insert, or delete, the returnedStage.Query
must be executed usingStage.MutationQuery.executeUpdate()
which returns an affected row count. In the case of a query:- If the result set has a single column, the results will be returned as scalars.
- Otherwise, if the result set has multiple columns, the results will
be returned as elements of arrays of type
Object[]
.
affected entities
are synchronized with the database before execution of the statement.- Parameters:
queryString
- The SQL select, update, insert, or delete statementaffectedEntities
- The entities which are affected by the statement
-
createQuery
<R> Stage.SelectionQuery<R> createQuery(jakarta.persistence.criteria.CriteriaQuery<R> criteriaQuery) Create an instance ofStage.SelectionQuery
for the given criteria query.- Parameters:
criteriaQuery
- TheCriteriaQuery
- Returns:
- The
Stage.SelectionQuery
instance for manipulation and execution - See Also:
-
EntityManager.createQuery(String)
-
getResultSetMapping
Obtain a native SQL result set mapping defined via the annotationSqlResultSetMapping
. -
getEntityGraph
Obtain a namedEntityGraph
-
createEntityGraph
Create a new mutableEntityGraph
-
createEntityGraph
Create a new mutable copy of a namedEntityGraph
-
getCriteriaBuilder
jakarta.persistence.criteria.CriteriaBuilder getCriteriaBuilder()Convenience method to obtain theCriteriaBuilder
.- Since:
- 3
-
QueryProducer.createSelectionQuery(String)