|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Transaction
A database transaction. Transaction instances can be obtained using
Database.openTransaction().
See the package description
on how to work with Transactions.
It is not intended that implementors be thread-safe. Instead, each client thread should obtain its own instance of Transaction.
Note: Implementors should make use of lazy initialization, that is, the real database connection should be created as late as possible.
| Method Summary | ||
|---|---|---|
void |
commit()
Commits this Transaction. |
|
|
create(T o)
Creates an object in the database. |
|
|
delete(T o)
Deletes a persistent object from the database. |
|
boolean |
isCommitted()
Returns whether this Transaction has been committed/rolled back. |
|
|
isPersistent(T o)
Returns whether an object is persistent. |
|
|
load(Class<T> clazz,
Serializable id)
Loads an object from the database. |
|
void |
rollback()
Rolls back this Transaction. |
|
| Method Detail |
|---|
<T> T load(Class<T> clazz,
Serializable id)
throws PersistenceException
clazz - the object's classid - the object's ID
PersistenceException - when loading the object fails
TransactionCommittedException - when this Transaction has been
commited/rolled back already
<T> Serializable create(T o)
throws PersistenceException
o - the object to create
PersistenceException - when creating the object fails
TransactionCommittedException - when this Transaction has been
commited/rolled back already
<T> void delete(T o)
throws PersistenceException
o - the object to delete
PersistenceException - when deleting the object fails
TransactionCommittedException - when this Transaction has been
commited/rolled back already
<T> boolean isPersistent(T o)
throws PersistenceException
PersistenceException - when there is a persistence-related error
void commit()
throws PersistenceException
PersistenceException - when committing this Transaction fails
TransactionCommittedException - when this Transaction has been
commited/rolled back already
void rollback()
throws PersistenceException
PersistenceException - when rolling back this Transaction fails
TransactionCommittedException - when this Transaction has been
commited/rolled back already
boolean isCommitted()
throws PersistenceException
PersistenceException - when there is a persistence-related error
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||