GigaSpaces - Open Spaces

org.openspaces.persistency.hibernate.iterator
Class AbstractChunkScrollableDataIterator

java.lang.Object
  extended by org.openspaces.persistency.hibernate.iterator.AbstractChunkScrollableDataIterator
All Implemented Interfaces:
com.gigaspaces.datasource.DataIterator, Iterator, MultiDataIterator
Direct Known Subclasses:
DefaultChunkScrollableDataIterator, StatelessChunkScrollableDataIterator

public abstract class AbstractChunkScrollableDataIterator
extends Object
implements MultiDataIterator

A base class that accespts a batch size and will create several iterators on the given entity by chunking it into batch size chuncks, each iterator will iterate only on the given chunk.

Author:
kimchy

Field Summary
protected  int chunkSize
           
protected  String entityName
           
protected  int fetchSize
           
protected  String hQuery
           
protected  boolean perfromOrderById
           
protected  org.hibernate.SessionFactory sessionFactory
           
protected  com.j_spaces.core.client.SQLQuery sqlQuery
           
 
Constructor Summary
AbstractChunkScrollableDataIterator(com.j_spaces.core.client.SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int chunkSize)
          Constructs a scrollable iterator over the given GigaSpaces SQLQuery.
AbstractChunkScrollableDataIterator(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int chunkSize)
          Constructs a scrollable iterator over the given entity name.
AbstractChunkScrollableDataIterator(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int chunkSize)
          Constructs a scrollable iterator over the given hibernate query string.
 
Method Summary
 void close()
           
protected abstract  com.gigaspaces.datasource.DataIterator createScrollableIteartorByEntityName(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
           
protected abstract  com.gigaspaces.datasource.DataIterator createScrollableIteartorByHibernateQuery(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int from, int size)
           
protected abstract  com.gigaspaces.datasource.DataIterator createScrollableIteartorBySQLQuery(com.j_spaces.core.client.SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
           
 boolean hasNext()
           
 com.gigaspaces.datasource.DataIterator[] iterators()
          Returns the underlying iterators.
 Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entityName

protected final String entityName

sqlQuery

protected final com.j_spaces.core.client.SQLQuery sqlQuery

hQuery

protected final String hQuery

sessionFactory

protected final org.hibernate.SessionFactory sessionFactory

perfromOrderById

protected final boolean perfromOrderById

fetchSize

protected final int fetchSize

chunkSize

protected final int chunkSize
Constructor Detail

AbstractChunkScrollableDataIterator

public AbstractChunkScrollableDataIterator(String entityName,
                                           org.hibernate.SessionFactory sessionFactory,
                                           int fetchSize,
                                           boolean performOrderById,
                                           int chunkSize)
Constructs a scrollable iterator over the given entity name.

Parameters:
entityName - The entity name to scroll over
sessionFactory - The session factory to use to construct the session
fetchSize - The fetch size of the scrollabale result set
performOrderById - Should the query perform order by id or not
chunkSize - The size of the chunks the entity table will be broken to

AbstractChunkScrollableDataIterator

public AbstractChunkScrollableDataIterator(com.j_spaces.core.client.SQLQuery sqlQuery,
                                           org.hibernate.SessionFactory sessionFactory,
                                           int fetchSize,
                                           boolean performOrderById,
                                           int chunkSize)
Constructs a scrollable iterator over the given GigaSpaces SQLQuery.

Parameters:
sqlQuery - The SQLQuery to scroll over
sessionFactory - The session factory to use to construct the session
fetchSize - The fetch size of the scrollabale result set
performOrderById - Should the query perform order by id or not
chunkSize - The size of the chunks the entity table will be broken to

AbstractChunkScrollableDataIterator

public AbstractChunkScrollableDataIterator(String hQuery,
                                           org.hibernate.SessionFactory sessionFactory,
                                           int fetchSize,
                                           int chunkSize)
Constructs a scrollable iterator over the given hibernate query string.

Parameters:
hQuery - The hiberante query string to scroll over
sessionFactory - The session factory to use to construct the session
fetchSize - The fetch size of the scrollabale result set
chunkSize - The size of the chunks the entity table will be broken to
Method Detail

iterators

public com.gigaspaces.datasource.DataIterator[] iterators()
Description copied from interface: MultiDataIterator
Returns the underlying iterators. Note, calling this method should only be performed if no iteration has happened.

Specified by:
iterators in interface MultiDataIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

close

public void close()
Specified by:
close in interface com.gigaspaces.datasource.DataIterator

createScrollableIteartorByEntityName

protected abstract com.gigaspaces.datasource.DataIterator createScrollableIteartorByEntityName(String entityName,
                                                                                               org.hibernate.SessionFactory sessionFactory,
                                                                                               int fetchSize,
                                                                                               boolean performOrderById,
                                                                                               int from,
                                                                                               int size)

createScrollableIteartorBySQLQuery

protected abstract com.gigaspaces.datasource.DataIterator createScrollableIteartorBySQLQuery(com.j_spaces.core.client.SQLQuery sqlQuery,
                                                                                             org.hibernate.SessionFactory sessionFactory,
                                                                                             int fetchSize,
                                                                                             boolean performOrderById,
                                                                                             int from,
                                                                                             int size)

createScrollableIteartorByHibernateQuery

protected abstract com.gigaspaces.datasource.DataIterator createScrollableIteartorByHibernateQuery(String hQuery,
                                                                                                   org.hibernate.SessionFactory sessionFactory,
                                                                                                   int fetchSize,
                                                                                                   int from,
                                                                                                   int size)

GigaSpaces - Open Spaces

Copyright © GigaSpaces.