Class HibernateCursorItemReader<T>

    • Constructor Detail

      • HibernateCursorItemReader

        public HibernateCursorItemReader()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
      • setParameterValues

        public void setParameterValues​(java.util.Map<java.lang.String,​java.lang.Object> parameterValues)
        The parameter values to apply to a query (map of name:value).
        Parameters:
        parameterValues - the parameter values to set
      • setQueryName

        public void setQueryName​(java.lang.String queryName)
        A query name for an externalized query. Either this or the { query string or the { query provider should be set.
        Parameters:
        queryName - name of a hibernate named query
      • setFetchSize

        public void setFetchSize​(int fetchSize)
        Fetch size used internally by Hibernate to limit amount of data fetched from database per round trip.
        Parameters:
        fetchSize - the fetch size to pass down to Hibernate
      • setQueryProvider

        public void setQueryProvider​(HibernateQueryProvider<T> queryProvider)
        A query provider. Either this or the {query string or the {query name should be set.
        Parameters:
        queryProvider - Hibernate query provider
      • setQueryString

        public void setQueryString​(java.lang.String queryString)
        A query string in HQL. Either this or the { query provider or the { query name should be set.
        Parameters:
        queryString - HQL query string
      • setSessionFactory

        public void setSessionFactory​(org.hibernate.SessionFactory sessionFactory)
        The Hibernate SessionFactory to use the create a session.
        Parameters:
        sessionFactory - the SessionFactory to set
      • setUseStatelessSession

        public void setUseStatelessSession​(boolean useStatelessSession)
        Can be set only in uninitialized state.
        Parameters:
        useStatelessSession - true to use StatelessSessionfalse to use standard hibernate Session
      • doOpen

        protected void doOpen()
                       throws java.lang.Exception
        Open hibernate session and create a forward-only cursor for the query.
        Specified by:
        doOpen in class AbstractItemCountingItemStreamItemReader<T>
        Throws:
        java.lang.Exception - Allows subclasses to throw checked exceptions for interpretation by the framework
      • jumpToItem

        protected void jumpToItem​(int itemIndex)
                           throws java.lang.Exception
        Wind forward through the result set to the item requested. Also clears the session every now and then (if stateful) to avoid memory problems. The frequency of session clearing is the larger of the fetch size (if set) and 100.
        Overrides:
        jumpToItem in class AbstractItemCountingItemStreamItemReader<T>
        Parameters:
        itemIndex - the first item to read
        Throws:
        java.lang.Exception - if there is a problem
        See Also:
        AbstractItemCountingItemStreamItemReader.jumpToItem(int)
      • doClose

        protected void doClose()
                        throws java.lang.Exception
        Close the cursor and hibernate session.
        Specified by:
        doClose in class AbstractItemCountingItemStreamItemReader<T>
        Throws:
        java.lang.Exception - Allows subclasses to throw checked exceptions for interpretation by the framework