org.exolab.castor.persist.spi
Interface PersistenceQuery
- AbstractCallQuery, MultiRSCallQuery, PostgreSQLCallQuery, ReturnedRSCallQuery, SQLQuery
public interface PersistenceQuery
The persistence engine implements this interface in order to allow
queries to be performed and multiple objects to be returned. This is
an extension of
Persistence.load(Object,ProposedEntity,Identity,AccessMode)
for dealing with complex
queries.
The caller takes full responsibility to assure integrity of
transactions and object caching and only relies on the engine to
assist in assuring that through the mechanisms available to it.
A query may be created once and used multiple times by calling the
execute(Object,AccessMode,boolean)
method. Query parameters are set each time prior
to executing the query.
See
Persistence
for information about locks, loading
objects, identities and stamps.
$Revision: 6230 $ $Date: 2006-04-11 15:26:07 -0600 (Tue, 11 Apr 2006) $ boolean | absolute(int row) - Moves the result of the query to the absolute position in the
resultset.
|
void | close() - Close the query and release all resources held by the query.
|
void | execute(Object conn, AccessMode accessMode, boolean scrollable) - Execute the query with the give connection and lock type.
|
Object | fetch(ProposedEntity proposedObject) - Loades the object.
|
Class | getResultType() - Returns the type of object returned by this query.
|
Identity | nextIdentity(Identity identity) - Returns the identity of the next object to be returned.
|
void | setParameter(int index, Object value) - Sets the value of a paramter.
|
int | size() - Finds the size of the resulting resultset from the query.
|
absolute
public boolean absolute(int row)
throws PersistenceException
Moves the result of the query to the absolute position in the
resultset.
close
public void close()
Close the query and release all resources held by the query.
execute
public void execute(Object conn,
AccessMode accessMode,
boolean scrollable)
throws PersistenceException
conn
- An open connectionaccessMode
- The access mode (null equals shared)scrollable
- The db cursor mode.
fetch
public Object fetch(ProposedEntity proposedObject)
throws PersistenceException
Loades the object. This method must be called immediately
after
nextIdentity(Identity)
with the same identity.
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
ObjectNotFoundException
. The query may proceed to the next
identity.
This method is equivalent to
Persistence.load(Object,ProposedEntity,Identity,AccessMode)
with a
known cache engine and access mode and acts on the query
results rather than issuing a new query to load the object.
proposedObject
- The fields to load into
- The object's stamp, or null
PersistenceException
- The object was not found in
persistent storage or any other persistence error occured.
getResultType
public Class getResultType()
Returns the type of object returned by this query.
- The type of object returned by this query
nextIdentity
public Identity nextIdentity(Identity identity)
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.
identity
- The identity of the previous object,
null if this method is called for the first time
- The identity of the next object, null if the
result set has been exhausted
setParameter
public void setParameter(int index,
Object value)
Sets the value of a paramter. Will complain if the parameter
is not of the specified type.
index
- The parameter indexvalue
- The parameter value
size
public int size()
throws PersistenceException
Finds the size of the resulting resultset from the query.
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com