Interface Mutiny.QueryProducer

All Known Subinterfaces:
Mutiny.Session, Mutiny.StatelessSession
All Known Implementing Classes:
MutinySessionDelegator, MutinyStatelessSessionDelegator
Enclosing interface:
Mutiny

public static interface Mutiny.QueryProducer
Operations common to objects which act as factories for instances of Mutiny.Query. This is a common supertype of Mutiny.Session and Mutiny.StatelessSession.
Since:
3.0
  • Method Details

    • createSelectionQuery

      <R> Mutiny.SelectionQuery<R> createSelectionQuery(String queryString, Class<R> resultType)
      Create an instance of Mutiny.SelectionQuery for the given HQL/JPQL query string.
      Parameters:
      queryString - The HQL/JPQL query
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String, Class)
    • createQuery

      <R> Mutiny.Query<R> createQuery(jakarta.persistence.TypedQueryReference<R> typedQueryReference)
      Create a typed Query instance for the given typed query reference.
      Parameters:
      typedQueryReference - the type query reference
      Returns:
      The 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:
    • createMutationQuery

      Mutiny.MutationQuery createMutationQuery(String queryString)
      Create an instance of Mutiny.MutationQuery for the given HQL/JPQL update or delete statement.
      Parameters:
      queryString - The HQL/JPQL query, update or delete statement
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String)
    • createMutationQuery

      Mutiny.MutationQuery createMutationQuery(jakarta.persistence.criteria.CriteriaUpdate<?> updateQuery)
      Create an instance of Mutiny.MutationQuery for the given update tree.
      Parameters:
      updateQuery - the update criteria query
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
      See Also:
    • createMutationQuery

      Mutiny.MutationQuery createMutationQuery(jakarta.persistence.criteria.CriteriaDelete<?> deleteQuery)
      Create an instance of Mutiny.MutationQuery for the given delete tree.
      Parameters:
      deleteQuery - the delete criteria query
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
      See Also:
    • createMutationQuery

      Mutiny.MutationQuery createMutationQuery(JpaCriteriaInsert<?> insert)
      Create a Mutiny.MutationQuery from the given insert select criteria tree
      Parameters:
      insert - the insert select criteria query
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
      See Also:
    • createQuery

      @Deprecated <R> Mutiny.Query<R> createQuery(String queryString)
      Deprecated.
      Create an instance of Mutiny.Query for the given HQL/JPQL query string or HQL/JPQL update or delete statement. In the case of an update or delete, the returned Mutiny.Query must be executed using Mutiny.MutationQuery.executeUpdate() which returns an affected row count.
      Parameters:
      queryString - The HQL/JPQL query, update or delete statement
      Returns:
      The Mutiny.Query instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String)
    • createQuery

      <R> Mutiny.SelectionQuery<R> createQuery(String queryString, Class<R> resultType)
      Create an instance of Mutiny.SelectionQuery for the given HQL/JPQL query string and query result type.
      Parameters:
      queryString - The HQL/JPQL query
      resultType - the Java type returned in each row of query results
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String, Class)
    • createQuery

      <R> Mutiny.SelectionQuery<R> createQuery(jakarta.persistence.criteria.CriteriaQuery<R> criteriaQuery)
      Create an instance of Mutiny.SelectionQuery for the given criteria query.
      Parameters:
      criteriaQuery - The CriteriaQuery
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String)
    • createQuery

      <R> Mutiny.MutationQuery createQuery(jakarta.persistence.criteria.CriteriaUpdate<R> criteriaUpdate)
      Create an instance of Mutiny.MutationQuery for the given criteria update.
      Parameters:
      criteriaUpdate - The CriteriaUpdate
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
    • createQuery

      <R> Mutiny.MutationQuery createQuery(jakarta.persistence.criteria.CriteriaDelete<R> criteriaDelete)
      Create an instance of Mutiny.MutationQuery for the given criteria delete.
      Parameters:
      criteriaDelete - The CriteriaDelete
      Returns:
      The Mutiny.MutationQuery instance for manipulation and execution
    • createNamedQuery

      <R> Mutiny.Query<R> createNamedQuery(String queryName)
      Create an instance of Mutiny.Query for the named query.
      Parameters:
      queryName - The name of the query
      Returns:
      The Mutiny.Query instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String)
    • createNamedQuery

      <R> Mutiny.SelectionQuery<R> createNamedQuery(String queryName, Class<R> resultType)
      Create an instance of Mutiny.SelectionQuery for the named query.
      Parameters:
      queryName - The name of the query
      resultType - the Java type returned in each row of query results
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
      • EntityManager.createQuery(String, Class)
    • createNativeQuery

      <R> Mutiny.Query<R> createNativeQuery(String queryString)
      Create an instance of Mutiny.Query for the given SQL query string, or SQL update, insert, or delete statement. In the case of an update, insert, or delete, the returned Mutiny.Query must be executed using Mutiny.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

      <R> Mutiny.Query<R> createNativeQuery(String queryString, AffectedEntities affectedEntities)
      Create an instance of Mutiny.Query for the given SQL query string, or SQL update, insert, or delete statement. In the case of an update, insert, or delete, the returned Mutiny.Query must be executed using Mutiny.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[].

      Any affected entities are synchronized with the database before execution of the statement.

      Parameters:
      queryString - The SQL select, update, insert, or delete statement
      affectedEntities - The entities which are affected by the statement
    • createNativeQuery

      <R> Mutiny.SelectionQuery<R> createNativeQuery(String queryString, Class<R> resultType)
      Create an instance of Mutiny.SelectionQuery for the given SQL query string, using the given resultType to interpret the results.
      • If the given result type is Object, or a built-in type such as String or Integer, 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 in arrays.
      • 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 query
      resultType - the Java type returned in each row of query results
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
      • EntityManager.createNativeQuery(String, Class)
    • createNativeQuery

      <R> Mutiny.SelectionQuery<R> createNativeQuery(String queryString, Class<R> resultType, AffectedEntities affectedEntities)
      Create an instance of Mutiny.SelectionQuery for the given SQL query string, using the given resultType to interpret the results.
      • If the given result type is Object, or a built-in type such as String or Integer, 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 in arrays.
      • 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.

      Any affected entities are synchronized with the database before execution of the query.

      Parameters:
      queryString - The SQL query
      resultType - the Java type returned in each row of query results
      affectedEntities - The entities which are affected by the query
      Returns:
      The Mutiny.Query instance for manipulation and execution
      See Also:
      • EntityManager.createNativeQuery(String, Class)
    • createNativeQuery

      <R> Mutiny.SelectionQuery<R> createNativeQuery(String queryString, ResultSetMapping<R> resultSetMapping)
      Create an instance of Mutiny.SelectionQuery for the given SQL query string, using the given ResultSetMapping to interpret the result set.
      Parameters:
      queryString - The SQL query
      resultSetMapping - the result set mapping
      Returns:
      The Mutiny.Query instance for manipulation and execution
      See Also:
    • createNativeQuery

      <R> Mutiny.SelectionQuery<R> createNativeQuery(String queryString, ResultSetMapping<R> resultSetMapping, AffectedEntities affectedEntities)
      Create an instance of Mutiny.SelectionQuery for the given SQL query string, using the given ResultSetMapping to interpret the result set.

      Any affected entities are synchronized with the database before execution of the query.

      Parameters:
      queryString - The SQL query
      resultSetMapping - the result set mapping
      affectedEntities - The entities which are affected by the query
      Returns:
      The Mutiny.SelectionQuery instance for manipulation and execution
      See Also:
    • getResultSetMapping

      <T> ResultSetMapping<T> getResultSetMapping(Class<T> resultType, String mappingName)
      Obtain a native SQL result set mapping defined via the annotation SqlResultSetMapping.
    • getEntityGraph

      <T> jakarta.persistence.EntityGraph<T> getEntityGraph(Class<T> rootType, String graphName)
      Obtain a named EntityGraph
    • createEntityGraph

      <T> jakarta.persistence.EntityGraph<T> createEntityGraph(Class<T> rootType)
      Create a new mutable EntityGraph
    • createEntityGraph

      <T> jakarta.persistence.EntityGraph<T> createEntityGraph(Class<T> rootType, String graphName)
      Create a new mutable copy of a named EntityGraph
    • getCriteriaBuilder

      jakarta.persistence.criteria.CriteriaBuilder getCriteriaBuilder()
      Convenience method to obtain the CriteriaBuilder.
      Since:
      3