Interface ExtendedQuerySupport


  • public interface ExtendedQuerySupport
    Interface implemented by the criteria provider. It is invoked to do some extended functionality like retrieving sql and executing statements with custom sql.
    Since:
    1.1.0
    Author:
    Christian Beikov
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ReturningResult<Object[]> executeReturning​(ServiceProvider serviceProvider, List<javax.persistence.Query> participatingQueries, javax.persistence.Query baseQuery, javax.persistence.Query exampleQuery, String sqlOverride)
      Executes and returns the returning result of the Query by replacing the SQL with the given overriding SQL query.
      int executeUpdate​(ServiceProvider serviceProvider, List<javax.persistence.Query> participatingQueries, javax.persistence.Query baseQuery, javax.persistence.Query query, String sqlOverride)
      Executes and returns the update count of the Query by replacing the SQL with the given overriding SQL query.
      List<String> getCascadingDeleteSql​(javax.persistence.EntityManager em, javax.persistence.Query query)
      Returns the cascading SQL delete queries for the given query object.
      List getResultList​(ServiceProvider serviceProvider, List<javax.persistence.Query> participatingQueries, javax.persistence.Query query, String sqlOverride)
      Returns the result list of the Query by replacing the SQL with the given overriding SQL query.
      Object getSingleResult​(ServiceProvider serviceProvider, List<javax.persistence.Query> participatingQueries, javax.persistence.Query query, String sqlOverride)
      Returns the single result of the Query by replacing the SQL with the given overriding SQL query.
      String getSql​(javax.persistence.EntityManager em, javax.persistence.Query query)
      Returns the SQL query for the given query object.
      String getSqlAlias​(javax.persistence.EntityManager em, javax.persistence.Query query, String alias)
      Returns the SQL table alias of the JPQL from node alias in the given query.
      int getSqlSelectAliasPosition​(javax.persistence.EntityManager em, javax.persistence.Query query, String alias)
      Returns the corresponding position of the given JPQL select alias in the SQL query's select clause of the given query object.
      int getSqlSelectAttributePosition​(javax.persistence.EntityManager em, javax.persistence.Query query, String attribute)
      Returns the corresponding position of the given JPQL attribute expression in the SQL query's select clause of the given query object.
      boolean supportsAdvancedSql()
      Returns whether the JPA provider supports advanced sql queries that need every method of this interface to work properly.
    • Method Detail

      • supportsAdvancedSql

        boolean supportsAdvancedSql()
        Returns whether the JPA provider supports advanced sql queries that need every method of this interface to work properly.
        Returns:
        Whether advanced sql queries are supported
      • getSql

        String getSql​(javax.persistence.EntityManager em,
                      javax.persistence.Query query)
        Returns the SQL query for the given query object.
        Parameters:
        em - The entity manager the query is associated to
        query - The JPA query
        Returns:
        The SQL query
      • getCascadingDeleteSql

        List<String> getCascadingDeleteSql​(javax.persistence.EntityManager em,
                                           javax.persistence.Query query)
        Returns the cascading SQL delete queries for the given query object.
        Parameters:
        em - The entity manager the query is associated to
        query - The JPA query
        Returns:
        The cascading SQL delete queries
      • getSqlAlias

        String getSqlAlias​(javax.persistence.EntityManager em,
                           javax.persistence.Query query,
                           String alias)
        Returns the SQL table alias of the JPQL from node alias in the given query.
        Parameters:
        em - The entity manager the query is associated to
        query - The JPA query
        alias - The from node alias
        Returns:
        The SQL table alias
      • getSqlSelectAliasPosition

        int getSqlSelectAliasPosition​(javax.persistence.EntityManager em,
                                      javax.persistence.Query query,
                                      String alias)
        Returns the corresponding position of the given JPQL select alias in the SQL query's select clause of the given query object.
        Parameters:
        em - The entity manager the query is associated to
        query - The JPA query
        alias - The JPQL select alias
        Returns:
        The position of the corresponding SQL select clause item
      • getSqlSelectAttributePosition

        int getSqlSelectAttributePosition​(javax.persistence.EntityManager em,
                                          javax.persistence.Query query,
                                          String attribute)
        Returns the corresponding position of the given JPQL attribute expression in the SQL query's select clause of the given query object.
        Parameters:
        em - The entity manager the query is associated to
        query - The JPA query
        attribute - The JPQL attribute expression
        Returns:
        The position of the corresponding SQL select clause item
      • getResultList

        List getResultList​(ServiceProvider serviceProvider,
                           List<javax.persistence.Query> participatingQueries,
                           javax.persistence.Query query,
                           String sqlOverride)
        Returns the result list of the Query by replacing the SQL with the given overriding SQL query.
        Parameters:
        serviceProvider - The service provider to access EntityManager and others
        participatingQueries - The list of participating queries from which to combine parameters
        query - The main query to execute
        sqlOverride - The actual SQL query to execute instead of the query's original SQL
        Returns:
        The result of the query
      • getSingleResult

        Object getSingleResult​(ServiceProvider serviceProvider,
                               List<javax.persistence.Query> participatingQueries,
                               javax.persistence.Query query,
                               String sqlOverride)
        Returns the single result of the Query by replacing the SQL with the given overriding SQL query.
        Parameters:
        serviceProvider - The service provider to access EntityManager and others
        participatingQueries - The list of participating queries from which to combine parameters
        query - The main query to execute
        sqlOverride - The actual SQL query to execute instead of the query's original SQL
        Returns:
        The result of the query
      • executeUpdate

        int executeUpdate​(ServiceProvider serviceProvider,
                          List<javax.persistence.Query> participatingQueries,
                          javax.persistence.Query baseQuery,
                          javax.persistence.Query query,
                          String sqlOverride)
        Executes and returns the update count of the Query by replacing the SQL with the given overriding SQL query.
        Parameters:
        serviceProvider - The service provider to access EntityManager and others
        participatingQueries - The list of participating queries from which to combine parameters
        baseQuery - The base query which represents the original modification query
        query - The main query to execute
        sqlOverride - The actual SQL query to execute instead of the query's original SQL
        Returns:
        The update count of the query
      • executeReturning

        ReturningResult<Object[]> executeReturning​(ServiceProvider serviceProvider,
                                                   List<javax.persistence.Query> participatingQueries,
                                                   javax.persistence.Query baseQuery,
                                                   javax.persistence.Query exampleQuery,
                                                   String sqlOverride)
        Executes and returns the returning result of the Query by replacing the SQL with the given overriding SQL query.
        Parameters:
        serviceProvider - The service provider to access EntityManager and others
        participatingQueries - The list of participating queries from which to combine parameters
        baseQuery - The base query which represents the original modification query
        exampleQuery - The example query providing the result type structure
        sqlOverride - The actual SQL query to execute instead of the query's original SQL
        Returns:
        The returning result of the query