Package org.hibernate

Interface SynchronizeableQuery<T>

  • All Known Subinterfaces:
    ProcedureCall, ProcedureCallImplementor<R>
    All Known Implementing Classes:
    ProcedureCallImpl

    public interface SynchronizeableQuery<T>
    A unifying interface for queries which can define tables (query spaces) to synchronize on. These query spaces affect the process of auto-flushing by determining which entities will be processed by auto-flush based on the table to which those entities are mapped and which are determined to have pending state changes. In a similar manner, these query spaces also affect how query result caching can recognize invalidated results.
    • Method Detail

      • getSynchronizedQuerySpaces

        Collection<String> getSynchronizedQuerySpaces()
        Obtain the list of query spaces the query is synchronized on.
        Returns:
        The list of query spaces upon which the query is synchronized.
      • addSynchronizedQuerySpace

        SynchronizeableQuery<T> addSynchronizedQuerySpace​(String querySpace)
        Adds a query space.
        Parameters:
        querySpace - The query space to be auto-flushed for this query.
        Returns:
        this, for method chaining
      • addSynchronizedQuerySpace

        default SynchronizeableQuery<T> addSynchronizedQuerySpace​(String... querySpaces)
        Adds one-or-more synchronized spaces
      • addSynchronizedTable

        default SynchronizeableQuery<T> addSynchronizedTable​(String tableExpression)
        Adds a table expression as a query space.
      • addSynchronizedTable

        default SynchronizeableQuery<T> addSynchronizedTable​(String... tableExpressions)
        Adds one-or-more synchronized table expressions
      • addSynchronizedEntityName

        SynchronizeableQuery<T> addSynchronizedEntityName​(String entityName)
                                                   throws MappingException
        Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking. Same as addSynchronizedQuerySpace(java.lang.String) for all tables associated with the given entity.
        Parameters:
        entityName - The name of the entity upon whose defined query spaces we should additionally synchronize.
        Returns:
        this, for method chaining
        Throws:
        MappingException - Indicates the given name could not be resolved as an entity
      • addSynchronizedEntityClass

        SynchronizeableQuery<T> addSynchronizedEntityClass​(Class entityClass)
                                                    throws MappingException
        Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking. Same as addSynchronizedQuerySpace(java.lang.String) for all tables associated with the given entity.
        Parameters:
        entityClass - The class of the entity upon whose defined query spaces we should additionally synchronize.
        Returns:
        this, for method chaining
        Throws:
        MappingException - Indicates the given class could not be resolved as an entity