Interface RegistryQuery<T>

  • All Superinterfaces:
    java.io.Serializable

    public interface RegistryQuery<T>
    extends java.io.Serializable
    Interface for query instances used by RegistryJpaIO.Read.
    • Field Detail

      • QUERY_FETCH_SIZE

        static final int QUERY_FETCH_SIZE
        Number of JPA entities to fetch in each batch during a query.

        With Hibernate, for result streaming to work, a query's fetchSize property must be set to a non-zero value.

        See Also:
        Constant Field Values
    • Method Detail

      • stream

        java.util.stream.Stream<T> stream()
      • createQuery

        static <T> RegistryQuery<T> createQuery​(java.lang.String sql,
                                                @Nullable
                                                java.util.Map<java.lang.String,​java.lang.Object> parameters,
                                                boolean nativeQuery)
        Returns a RegistryQuery that creates a string query from constant text.
        Type Parameters:
        T - Type of each row in the result set, Object in single-select queries, and Object[] in multi-select queries.
        Parameters:
        nativeQuery - whether the given string is to be interpreted as a native query or JPQL.
        parameters - parameters to be substituted in the query.
      • createQuery

        static <T> RegistryQuery<T> createQuery​(java.lang.String jpql,
                                                @Nullable
                                                java.util.Map<java.lang.String,​java.lang.Object> parameters,
                                                java.lang.Class<T> clazz)
        Returns a RegistryQuery that creates a typed JPQL query from constant text.
        Type Parameters:
        T - Type of each row in the result set.
        Parameters:
        parameters - parameters to be substituted in the query.
      • createQuery

        static <T> RegistryQuery<T> createQuery​(RegistryQuery.CriteriaQuerySupplier<T> criteriaQuery)
        Returns a RegistryQuery from a CriteriaQuery supplier.

        A serializable supplier is needed in because CriteriaQuery itself must be created within a transaction, and we are not in a transaction yet when this function is called to set up the pipeline.

        Type Parameters:
        T - Type of each row in the result set.
      • detach

        static <T> T detach​(javax.persistence.EntityManager entityManager,
                            T object)
        Removes an object from the JPA session cache if applicable.
        Parameters:
        object - An object that represents a row in the result set. It may be a JPA entity, a non-entity object, or an array that holds JPA entities and/or non-entities.
      • detachObject

        static void detachObject​(javax.persistence.EntityManager entityManager,
                                 java.lang.Object object)