GigaSpaces XAP 7.0 API

org.openspaces.persistency.hibernate.iterator
Class AbstractChunkDataIterator

java.lang.Object
  extended by org.openspaces.persistency.hibernate.iterator.AbstractChunkDataIterator
All Implemented Interfaces:
DataIterator, Iterator, MultiDataIterator
Direct Known Subclasses:
DefaultChunkListDataIterator, DefaultChunkScrollableDataIterator, StatelessChunkListDataIterator, StatelessChunkScrollableDataIterator

public abstract class AbstractChunkDataIterator
extends Object
implements MultiDataIterator

A base class that accepts 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  SQLQuery sqlQuery
           
 
Constructor Summary
AbstractChunkDataIterator(SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int chunkSize)
          Constructs a scrollable iterator over the given GigaSpaces SQLQuery.
AbstractChunkDataIterator(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int chunkSize)
          Constructs a scrollable iterator over the given entity name.
AbstractChunkDataIterator(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int chunkSize)
          Constructs a scrollable iterator over the given hibernate query string.
 
Method Summary
 void close()
          Clean up after any resources associated with this iterator The iterator can be closed even if the iterator wasn't iterated over all of its elements.
protected abstract  DataIterator createIteratorByEntityName(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
           
protected abstract  DataIterator createIteratorByHibernateQuery(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int from, int size)
           
protected abstract  DataIterator createIteratorBySQLQuery(SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
           
 boolean hasNext()
           
 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 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

AbstractChunkDataIterator

public AbstractChunkDataIterator(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 scrollable 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

AbstractChunkDataIterator

public AbstractChunkDataIterator(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

AbstractChunkDataIterator

public AbstractChunkDataIterator(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 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()
Description copied from interface: DataIterator
Clean up after any resources associated with this iterator The iterator can be closed even if the iterator wasn't iterated over all of its elements.

Specified by:
close in interface DataIterator

createIteratorByEntityName

protected abstract DataIterator createIteratorByEntityName(String entityName,
                                                           org.hibernate.SessionFactory sessionFactory,
                                                           int fetchSize,
                                                           boolean performOrderById,
                                                           int from,
                                                           int size)

createIteratorBySQLQuery

protected abstract DataIterator createIteratorBySQLQuery(SQLQuery sqlQuery,
                                                         org.hibernate.SessionFactory sessionFactory,
                                                         int fetchSize,
                                                         boolean performOrderById,
                                                         int from,
                                                         int size)

createIteratorByHibernateQuery

protected abstract DataIterator createIteratorByHibernateQuery(String hQuery,
                                                               org.hibernate.SessionFactory sessionFactory,
                                                               int fetchSize,
                                                               int from,
                                                               int size)

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.