GigaSpaces XAP 7.0 API

org.openspaces.persistency.hibernate.iterator
Class AbstractScrollableDataIterator

java.lang.Object
  extended by org.openspaces.persistency.hibernate.iterator.AbstractScrollableDataIterator
All Implemented Interfaces:
DataIterator, Iterator
Direct Known Subclasses:
DefaultScrollableDataIterator, StatelessScrollableDataIterator

public abstract class AbstractScrollableDataIterator
extends Object
implements DataIterator

A base class for scrollable result set (ScrollableResults created based on either an entity name or a SQLQuery. Also allows for a "from" and "size" to be provided, in this case, it will iterate from the given index till "size" results.

Author:
kimchy

Field Summary
protected  String entityName
           
protected  int fetchSize
           
protected  int from
           
protected  String hQuery
           
protected  boolean perfromOrderById
           
protected  org.hibernate.SessionFactory sessionFactory
           
protected  int size
           
protected  SQLQuery sqlQuery
           
 
Constructor Summary
AbstractScrollableDataIterator(SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById)
          Constructs a scrollable iterator over the given GigaSpaces SQLQuery.
AbstractScrollableDataIterator(SQLQuery sqlQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
          Constructs a scrollable iterator over the given GigaSpaces SQLQuery.
AbstractScrollableDataIterator(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize)
          Constructs a scrollable iterator over the given hibernate query string.
AbstractScrollableDataIterator(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById)
          Constructs a scrollable iterator over the given entity name.
AbstractScrollableDataIterator(String entityName, org.hibernate.SessionFactory sessionFactory, int fetchSize, boolean performOrderById, int from, int size)
          Constructs a scrollable iterator over the given entity name.
AbstractScrollableDataIterator(String hQuery, org.hibernate.SessionFactory sessionFactory, int fetchSize, int from, int size)
          Constructs a scrollable iterator over the given hibernate query string.
 
Method Summary
protected abstract  void clear()
           
 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  org.hibernate.ScrollableResults createCursor()
           
protected abstract  void doClose()
           
 boolean hasNext()
           
 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

from

protected final int from

size

protected final int size
Constructor Detail

AbstractScrollableDataIterator

public AbstractScrollableDataIterator(String entityName,
                                      org.hibernate.SessionFactory sessionFactory,
                                      int fetchSize,
                                      boolean performOrderById)
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

AbstractScrollableDataIterator

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

Parameters:
entityName - The entity name to scroll over
sessionFactory - The session factory to use to constrcut the session
fetchSize - The fetch size of the scrollable result set
performOrderById - Should the query perform order by id or not
from - The from index to scroll from
size - The size of data to scroll to

AbstractScrollableDataIterator

public AbstractScrollableDataIterator(String hQuery,
                                      org.hibernate.SessionFactory sessionFactory,
                                      int fetchSize)
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 scrollable result set

AbstractScrollableDataIterator

public AbstractScrollableDataIterator(String hQuery,
                                      org.hibernate.SessionFactory sessionFactory,
                                      int fetchSize,
                                      int from,
                                      int size)
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 scrollable result set
from - The from index to scroll from
size - The size of data to scroll to

AbstractScrollableDataIterator

public AbstractScrollableDataIterator(SQLQuery sqlQuery,
                                      org.hibernate.SessionFactory sessionFactory,
                                      int fetchSize,
                                      boolean performOrderById)
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

AbstractScrollableDataIterator

public AbstractScrollableDataIterator(SQLQuery sqlQuery,
                                      org.hibernate.SessionFactory sessionFactory,
                                      int fetchSize,
                                      boolean performOrderById,
                                      int from,
                                      int size)
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 scrollable result set
performOrderById - Should the query perform order by id or not
from - The from index to scroll from
size - The size of data to scroll to
Method Detail

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

doClose

protected abstract void doClose()

clear

protected abstract void clear()

createCursor

protected abstract org.hibernate.ScrollableResults createCursor()

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.