|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.subshell.persistence.mapper.TransactionPersistenceMapper<T>
public abstract class TransactionPersistenceMapper<T>
Abstract persistence mapper implementation which is provided with a Transaction
.
Note: Subclasses must retain the (Class, Transaction)
constructor
which must be publicly accessible.
Constructor Summary | |
---|---|
TransactionPersistenceMapper(Class<T> clazz,
Transaction transaction)
Creates a new TransactionPersistenceMapper. |
Method Summary | |
---|---|
Serializable |
create(T o)
Persists an object in the database. |
void |
delete(T o)
Deletes a persistent object from the database. |
protected Transaction |
getTransaction()
Returns the transaction associated with this persistence mapper. |
boolean |
isPersistent(T o)
Returns whether an object is persistent. |
T |
load(Serializable id)
Loads an object from the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransactionPersistenceMapper(Class<T> clazz, Transaction transaction)
clazz
- class of the objects this persistence mapper is supposed to handletransaction
- database transactionMethod Detail |
---|
public T load(Serializable id) throws PersistenceException
load
in interface PersistenceMapper<T>
id
- the object's ID
PersistenceException
- when loading the object fails
TransactionCommittedException
- when the underlying Transaction has been
commited/rolled back alreadypublic Serializable create(T o) throws PersistenceException
create
in interface PersistenceMapper<T>
o
- the object to persist
PersistenceException
- when persisting the object fails
TransactionCommittedException
- when the underlying Transaction has been
commited/rolled back alreadypublic void delete(T o) throws PersistenceException
delete
in interface PersistenceMapper<T>
o
- the object to delete
PersistenceException
- when deleting the object fails
TransactionCommittedException
- when the underlying Transaction has been
commited/rolled back alreadypublic boolean isPersistent(T o) throws PersistenceException
isPersistent
in interface PersistenceMapper<T>
PersistenceException
- when there is a persistence-related errorprotected Transaction getTransaction()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |