Interface SynchronizeableQuery

  • All Known Subinterfaces:
    NativeQuery<T>, NativeQueryImplementor<R>, ProcedureCall, ProcedureCallImplementor<R>
    All Known Implementing Classes:
    NativeQueryImpl, ProcedureCallImpl

    public interface SynchronizeableQuery
    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 addSynchronizedQuerySpace​(String querySpace)
        Adds a query space.
        Parameters:
        querySpace - The query space to be auto-flushed for this query.
        Returns:
        this, for method chaining
      • addSynchronizedEntityName

        SynchronizeableQuery 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 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