|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXFetchSpecificationBatchIterator
The goal of the fetch specification batch iterator is to have the ability to iterate through a fetch specification that might fetch one million enterprise objects. Fetching all of the objects into a singel editing context is prohibitive in the amount of memory needed and in the time taken to process all of the rows. The iterator allows one to iterate through the fetched objects only hydrating those objects need in small bite size pieces. The iterator also allows you to swap out editing contexts between calls to nextBatch, which will allow the garbage collector to collect the old editing context and the previous batch of enterprise objects.
Field Summary | |
protected int |
batchSize
holds the selected batch size |
protected int |
currentBatchIndex
holds the current batch index |
protected int |
currentObjectFetchCount
holds the number of objects fetched |
static int |
DefaultBatchSize
holds the default batch size, any bigger than this an Oracle has a fit |
protected EOEditingContext |
editingContext
holds a reference to the selected editing context |
protected EOFetchSpecification |
fetchSpecification
holds a reference to the fetch spec to iterate over |
static ERXLogger |
log
logging support |
protected NSArray |
primaryKeys
holds an array of primary key values to iterate through |
Constructor Summary | |
ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecication)
Constructs a fetch specification iterator for a given fetch specification with the default batch size. |
|
ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification,
EOEditingContext ec)
Constructs a fetch specification iterator for a given fetch specification with the default batch size. |
|
ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification,
EOEditingContext ec,
int batchSize)
Constructs a fetch specification iterator for a given fetch specification and a batch size. |
|
ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification,
NSArray pkeys,
EOEditingContext ec,
int batchSize)
Constructs a fetch specification iterator for a fetch specification, an optional set of pre-fetched primary keys and a batch size. |
Method Summary | |
int |
batchCount()
Gets the number of batches for a given iterator. |
int |
batchSize()
Gets the batch size. |
int |
currentBatchIndex()
Gets the current batch index. |
int |
currentObjectFetchCount()
Gets the current number of objects fetched thus far. |
EOEditingContext |
editingContext()
Gets the currently set editing context. |
protected void |
fetchPrimaryKeys()
Method used to fetch the primary keys of the objects for the given fetch specification. |
protected boolean |
hasFetchedPrimaryKeys()
Determines if the primary keys have been fetched yet for the given fetch specification. |
boolean |
hasNextBatch()
Determines if the iterator has another batch. |
NSArray |
nextBatch()
Gets the next batch of enterprise objects for the given fetch specification. |
void |
reset()
Resets the batch iterator so it will refetch it's primary keys again. |
void |
setBatchSize(int batchSize)
Sets the batch size. |
void |
setEditingContext(EOEditingContext ec)
Sets the editing context used to fetch objects against. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DefaultBatchSize
public static final ERXLogger log
protected int batchSize
protected EOEditingContext editingContext
protected EOFetchSpecification fetchSpecification
protected NSArray primaryKeys
protected int currentBatchIndex
protected int currentObjectFetchCount
Constructor Detail |
public ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecication)
fetchSpecication
- to iterate throughpublic ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification, EOEditingContext ec)
ec
- editing context to fetch againstpublic ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification, EOEditingContext ec, int batchSize)
ec
- editing context to fetch againstbatchSize
- number of objects to fetch in a given batchpublic ERXFetchSpecificationBatchIterator(EOFetchSpecification fetchSpecification, NSArray pkeys, EOEditingContext ec, int batchSize)
pkeys
- primary keys to iterate throughec
- editing context to fetch againstbatchSize
- number of objects to fetch in a given batchMethod Detail |
public int batchSize()
public int currentBatchIndex()
public int batchCount()
public int currentObjectFetchCount()
public void setBatchSize(int batchSize)
batchSize
- to be set.public EOEditingContext editingContext()
public void setEditingContext(EOEditingContext ec)
ec
- editing context used to fetch againstpublic boolean hasNextBatch()
public NSArray nextBatch()
protected boolean hasFetchedPrimaryKeys()
protected void fetchPrimaryKeys()
public void reset()
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |