|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OTMConnection
A OTMConnection within the given Environment
Method Summary | |
---|---|
void |
close()
Close the OTMConnection |
void |
deletePersistent(Object obj)
Mark the given object for deletion from the persistent store. |
Collection |
getCollectionByQuery(Query query)
|
Collection |
getCollectionByQuery(Query query,
int lock)
|
int |
getCount(Query query)
return the number of objects that would be returned from this query |
ClassDescriptor |
getDescriptorFor(Class clazz)
|
EditingContext |
getEditingContext()
Get the EditingContext associated with the transaction to which this connection belongs. |
Identity |
getIdentity(Object object)
Get the identity of the object |
Iterator |
getIteratorByOQLQuery(OQLQuery query)
|
Iterator |
getIteratorByOQLQuery(OQLQuery query,
int lock)
|
Iterator |
getIteratorByQuery(Query query)
|
Iterator |
getIteratorByQuery(Query query,
int lock)
|
Object |
getObjectByIdentity(Identity oid)
Get the object with the given Identity from the persistent store. |
Object |
getObjectByIdentity(Identity oid,
int lock)
Get the object with the given Identity from the persistent store with the given lock value. |
Transaction |
getTransaction()
Obtain the Transaction this connection is associated with |
void |
invalidate(Identity oid)
In the case if the program need to change the objects via direct JDBC call, it should first call invalidate() for the object, which will lock the object for write and tell OJB OTM that it must be re-read from the database, only after that you shold perform JDBC operation. |
void |
invalidateAll()
clear the underlying caches |
boolean |
isClosed()
check if the OTMConnection is closed |
void |
lockForWrite(Object object)
Lock the given object for Write. |
void |
makePersistent(Object object)
Make the given object persistent by inserting it into the database. |
EnhancedOQLQuery |
newOQLQuery()
returns a new OQL Query. |
EnhancedOQLQuery |
newOQLQuery(int lock)
returns a new OQL Query. |
void |
refresh(Object object)
Updates the values in the object from the data in data store. |
ObjectCache |
serviceObjectCache()
get the global cache |
void |
setTransaction(Transaction tx)
Associate this connection with a given transaction. |
Method Detail |
---|
void makePersistent(Object object) throws LockingException
object
- the object to be made persistent
LockingException
Transaction getTransaction()
void setTransaction(Transaction tx)
void deletePersistent(Object obj) throws LockingException
obj
- the object to delete
LockingException
void lockForWrite(Object object) throws LockingException
object
- the object to be locked for write.
LockingException
Object getObjectByIdentity(Identity oid) throws LockingException
oid
- the Identity of the object to fetch
LockingException
- thrown by the LockManager to avoid deadlocks. The fetch could be
re-submitted.Object getObjectByIdentity(Identity oid, int lock) throws LockingException
oid
- the Identity of the object to fetchlock
- the lock that need to be acquired on the object
Possible values are:
LockType.NO_LOCK (aka read only) - changes to the object will not be written to database;
LockType.READ_LOCK (aka optimistic lock) - changes to the object will be written to the database,
in this case the lock will be automatically upgraded to the write lock on transaction commit;
LockType.WRITE_LOCK (aka pessimistic lock) - changes to the object will be written to the database.
LockingException
- thrown by the LockManager to avoid a deadlock.Iterator getIteratorByQuery(Query query)
query
- The query to execute
Iterator getIteratorByQuery(Query query, int lock)
query
- The query to executelock
- the lock that need to be acquired on the object
Possible values are:
LockType.NO_LOCK (aka read only) - changes to the object will not be written to database;
LockType.READ_LOCK (aka optimistic lock) - changes to the object will be written to the database,
in this case the lock will be automatically upgraded to the write lock on transaction commit;
LockType.WRITE_LOCK (aka pessimistic lock) - changes to the object will be written to the database.
Iterator getIteratorByOQLQuery(OQLQuery query)
query
- The OQL query to execute
Iterator getIteratorByOQLQuery(OQLQuery query, int lock)
query
- The OQL query to executelock
- the lock that need to be acquired on the object
Possible values are:
LockType.NO_LOCK (aka read only) - changes to the object will not be written to database;
LockType.READ_LOCK (aka optimistic lock) - changes to the object will be written to the database,
in this case the lock will be automatically upgraded to the write lock on transaction commit;
LockType.WRITE_LOCK (aka pessimistic lock) - changes to the object will be written to the database.
Collection getCollectionByQuery(Query query, int lock)
query
- The query to executelock
- the lock that need to be acquired on the object
Possible values are:
LockType.NO_LOCK (aka read only) - changes to the object will not be written to database;
LockType.READ_LOCK (aka optimistic lock) - changes to the object will be written to the database,
in this case the lock will be automatically upgraded to the write lock on transaction commit;
LockType.WRITE_LOCK (aka pessimistic lock) - changes to the object will be written to the database.
Collection getCollectionByQuery(Query query)
query
- The query to execute
Identity getIdentity(Object object)
object
- The object
ClassDescriptor getDescriptorFor(Class clazz)
EditingContext getEditingContext()
void invalidate(Identity oid) throws LockingException
LockingException
void invalidateAll() throws LockingException
LockingException
EnhancedOQLQuery newOQLQuery()
EnhancedOQLQuery newOQLQuery(int lock)
lock
- the lock that need to be acquired on the object
Possible values are:
LockType.NO_LOCK (aka read only) - changes to the object will not be written to database;
LockType.READ_LOCK (aka optimistic lock) - changes to the object will be written to the database,
in this case the lock will be automatically upgraded to the write lock on transaction commit;
LockType.WRITE_LOCK (aka pessimistic lock) - changes to the object will be written to the database.
int getCount(Query query)
query
-
void close()
boolean isClosed()
ObjectCache serviceObjectCache()
void refresh(Object object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |