GigaSpaces - Open Spaces

org.openspaces.persistency.hibernate.iterator
Class AbstractChunkDataIterator

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

public abstract class AbstractChunkDataIterator
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
AbstractChunkDataIterator(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.
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()
           
protected abstract  com.gigaspaces.datasource.DataIterator createIteartorByEntityName(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
           
protected abstract  com.gigaspaces.datasource.DataIterator createIteartorByHibernateQuery(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int from, int size)
           
protected abstract  com.gigaspaces.datasource.DataIterator createIteartorBySQLQuery(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

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

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 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

createIteartorByEntityName

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

createIteartorBySQLQuery

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

createIteartorByHibernateQuery

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

GigaSpaces - Open Spaces

Copyright © GigaSpaces.