类 HibernateItemReaderHelper<T>

  • 所有已实现的接口:
    org.springframework.beans.factory.InitializingBean

    public class HibernateItemReaderHelper<T>
    extends java.lang.Object
    implements org.springframework.beans.factory.InitializingBean
    Internal shared state helper for hibernate readers managing sessions and queries.
    作者:
    Dave Syer
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidafterPropertiesSet() 
      voidclear()
      Clear the session if stateful.
      voidclose()
      Close the open session (stateful or otherwise).
      org.hibernate.QuerycreateQuery()
      Open appropriate type of hibernate session and create the query.
      org.hibernate.ScrollableResultsgetForwardOnlyCursor​(int fetchSize, java.util.Map<java.lang.String,​java.lang.Object> parameterValues)
      Get a cursor over all of the results, with the forward-only flag set.
      voidjumpToItem​(org.hibernate.ScrollableResults cursor, int itemIndex, int flushInterval)
      Scroll through the results up to the item specified.
      java.util.Collection<? extends T>readPage​(int page, int pageSize, int fetchSize, java.util.Map<java.lang.String,​java.lang.Object> parameterValues)
      Read a page of data, clearing the existing session (if necessary) first, and creating a new session before executing the query.
      voidsetQueryName​(java.lang.String queryName) 
      voidsetQueryProvider​(HibernateQueryProvider<? extends T> queryProvider) 
      voidsetQueryString​(java.lang.String queryString) 
      voidsetSessionFactory​(org.hibernate.SessionFactory sessionFactory) 
      voidsetUseStatelessSession​(boolean useStatelessSession)
      Can be set only in uninitialized state.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • setQueryName

        public void setQueryName​(java.lang.String queryName)
        参数:
        queryName - name of a hibernate named query
      • setQueryString

        public void setQueryString​(java.lang.String queryString)
        参数:
        queryString - HQL query string
      • setUseStatelessSession

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

        public void setSessionFactory​(org.hibernate.SessionFactory sessionFactory)
        参数:
        sessionFactory - hibernate session factory
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception
      • getForwardOnlyCursor

        public org.hibernate.ScrollableResults getForwardOnlyCursor​(int fetchSize,
                                                                    java.util.Map<java.lang.String,​java.lang.Object> parameterValues)
        Get a cursor over all of the results, with the forward-only flag set.
        参数:
        fetchSize - the fetch size to use retrieving the results
        parameterValues - the parameter values to use (or null if none).
        返回:
        a forward-only ScrollableResults
      • createQuery

        public org.hibernate.Query createQuery()
        Open appropriate type of hibernate session and create the query.
        返回:
        a Hibernate Query
      • jumpToItem

        public void jumpToItem​(org.hibernate.ScrollableResults cursor,
                               int itemIndex,
                               int flushInterval)
        Scroll through the results up to the item specified.
        参数:
        cursor - the results to scroll over
        itemIndex - index to scroll to
        flushInterval - the number of items to scroll past before flushing
      • close

        public void close()
        Close the open session (stateful or otherwise).
      • readPage

        public java.util.Collection<? extends TreadPage​(int page,
                                                          int pageSize,
                                                          int fetchSize,
                                                          java.util.Map<java.lang.String,​java.lang.Object> parameterValues)
        Read a page of data, clearing the existing session (if necessary) first, and creating a new session before executing the query.
        参数:
        page - the page to read (starting at 0)
        pageSize - the size of the page or maximum number of items to read
        fetchSize - the fetch size to use
        parameterValues - the parameter values to use (if any, otherwise null)
        返回:
        a collection of items
      • clear

        public void clear()
        Clear the session if stateful.