org.exolab.castor.persist
Class QueryResults
java.lang.Object
org.exolab.castor.persist.QueryResults
public final class QueryResults
extends java.lang.Object
The result of a query in the context of a transaction. A query is
executed against the cache engine in the context of a transaction.
The result of a query is this object that can be used to obtain
the next object in the query.
$Revision: 7120 $ $Date: 2006-04-22 11:05:30 -0600 (Sat, 22 Apr 2006) $
close
public void close()
Close the query and release all resources held by the query.
fetch
public Object fetch()
throws PersistenceException
Loads the specified object with the identity. The identity must
have been retrieved with a call to
nextIdentity()
.
If the object is locked by another transaction this method will
block until the lock is released, or a timeout occured. If a
timeout occurs or the object has been deleted by the other
transaction, this method will report an. The query may proceed to the next
identity.
If the object has been deleted in this transaction, this method
will report an. However, the caller may iterate to and obtain the next object.
This method is equivalent to
TransactionContext.fetch(ClassMolder,Identity,AccessMode)
with a know cache engine, identity and lock and acts on the query
results rather than issuing a new query to load the object.
PersistenceException
- An error reported by the persistence engine. The object was
not found in persistent storage. The transaction has been closed. Could not
acquire a lock on the object.
getResultType
public Class getResultType()
Returns the type of object returned by this query.
- The type of object returned by this query
getTransaction
public TransactionContext getTransaction()
Returns the transaction context in which this query was opened.
The transaction may be closed.
- The query's transaction context
nextIdentity
public Object nextIdentity()
throws PersistenceException
Returns the identity of the next object to be returned.
Calling this method multiple time will skip objects.
When the result set has been exhuasted, this method will
return null.
- The identity of the next object
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com