|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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(java.lang.Object, org.castor.persist.ProposedObject, java.lang.Object, org.exolab.castor.mapping.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)
method. Query parameters are set each time prior
to executing the query.
See Persistence
for information about locks, loading
objects, identities and stamps.
Persistence
Method Summary | |
---|---|
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(java.lang.Object conn,
AccessMode accessMode)
Execute the query with the give connection and lock type. |
void |
execute(java.lang.Object conn,
AccessMode accessMode,
boolean scrollable)
same as above, but parameterized for scrollable resultsets. |
java.lang.Object |
fetch(ProposedObject proposedObject,
java.lang.Object identity)
Loades the object. |
int |
getParameterCount()
Returns the number of parameters required for this query. |
java.lang.Class |
getParameterType(int index)
Returns the type of a parameter required by this query. |
java.lang.Class |
getResultType()
Returns the type of object returned by this query. |
java.lang.Object |
nextIdentity(java.lang.Object identity)
Returns the identity of the next object to be returned. |
void |
setParameter(int index,
java.lang.Object value)
Sets the value of a paramter. |
int |
size()
finds the size of the resulting resultset from the query. |
Method Detail |
---|
int getParameterCount()
java.lang.Class getParameterType(int index)
index
- The parameter index
void setParameter(int index, java.lang.Object value)
index
- The parameter indexvalue
- The parameter valuejava.lang.Class getResultType()
void execute(java.lang.Object conn, AccessMode accessMode) throws QueryException, PersistenceException
nextIdentity(java.lang.Object)
and fetch(org.castor.persist.ProposedObject, java.lang.Object)
. The
query parameters will be reset. A new query may be issued by
providing new query parameters and calling execute(Object, AccessMode)
.
conn
- An open connectionaccessMode
- The access mode (null equals shared)
QueryException
- An invalid query
PersistenceException
- An error reported by the
persistence enginevoid execute(java.lang.Object conn, AccessMode accessMode, boolean scrollable) throws QueryException, PersistenceException
conn
- An open connectionaccessMode
- The access mode (null equals shared)scrollable
- The db cursor mode.
QueryException
- An invalid query
PersistenceException
- An error reported by the
persistence enginejava.lang.Object nextIdentity(java.lang.Object identity) throws PersistenceException
identity
- The identity of the previous object,
null if this method is called for the first time
PersistenceException
- An error reported by the
persistence enginejava.lang.Object fetch(ProposedObject proposedObject, java.lang.Object identity) throws ObjectNotFoundException, PersistenceException
nextIdentity(java.lang.Object)
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(java.lang.Object, org.castor.persist.ProposedObject, java.lang.Object, org.exolab.castor.mapping.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.
fields
- The fields to load intoidentity
- The object's identity
ObjectNotFoundException
- The object was not found in
persistent storage
PersistenceException
- A persistence error occuredPersistence.load(java.lang.Object, org.castor.persist.ProposedObject, java.lang.Object, org.exolab.castor.mapping.AccessMode)
void close()
boolean absolute(int row) throws PersistenceException
row
- The row to move to
PersistenceException
- A persistence error occuredint size() throws PersistenceException
PersistenceException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |