Package org.hibernate

Interface SynchronizeableQuery<T>

  • All Known Subinterfaces:
    NativeQuery<T>, NativeQueryImplementor<T>, ProcedureCall, ProcedureCallImplementor<R>, SQLQuery<T>

    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

        java.util.Collection<java.lang.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​(java.lang.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​(java.lang.String... querySpaces)
        Adds one-or-more synchronized spaces
      • addSynchronizedTable

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

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

        SynchronizeableQuery<T> addSynchronizedEntityName​(java.lang.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​(java.lang.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
      • addSynchronizedEntityClass

        default SynchronizeableQuery<T> addSynchronizedEntityClass​(java.lang.Class<?>... entityClasses)
                                                            throws MappingException
        Adds one-or-more entities (by class) whose tables should be added as synchronized spaces
        Throws:
        MappingException