|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface PersistenceContext
Memory data structure attached to a thread
that manages objects that are persistent.
A persistence context can be nested in another one,
in that case any commit() or rollback()
of an enclosing context will automatically
commit() or rollback() all nested
context.
Because a persistence context is attached to a
thread, all methods are not required to be thread safe.
PersistenceManager| Nested Class Summary | |
|---|---|
static class |
PersistenceContext.Kind
The kind of peristence context. |
| Method Summary | ||
|---|---|---|
void |
commit()
Commits all persistent object states. |
|
|
create(Class<T> persistenceType)
Create a persistent object belong to the current context. |
|
void |
delete(Object o)
Deletes an object from the context. |
|
|
findAll(Class<T> persistenceType)
Returns a view of all persistent objects of a specific persistent class. |
|
|
findById(long id,
Class<T> persistenceType)
Returns a persistent object from its id. |
|
PersistenceContext.Kind |
getKind()
Returns the current context kind. |
|
void |
rollback()
Discards all modificatiions on all objects states of the current context. |
|
| Method Detail |
|---|
PersistenceContext.Kind getKind()
PersistenceManager.newContext(fr.umlv.javaodb.PersistenceContext.Kind))
because it can be downgraded/upgraded due to the fact that
contexts of other kinds may exist.
<T> T findById(long id,
Class<T> persistenceType)
throws PersistenceException
T - the type of the persistent class.id - the id of the object, must be non null.persistenceType - the persistent type.
PersistenceException - if the type is not persistent type,
if the current manager is closed,
if the current context is already commited or
if id is not a valid id.
<T> Set<? extends T> findAll(Class<T> persistenceType)
throws PersistenceException
T - the type of the persistent class.persistenceType - the persistent type
PersistenceException - if the type is not persistent type,
if the current manager is closed or
if the current context was already commited.
<T> T create(Class<T> persistenceType)
throws PersistenceException
commited.
The value of the properties of the newly created object are initialized
to the default value of their type.
T - the type of the persistent interface.persistenceType - the persistent type.
PersistenceException - if the type is not persistent type,
in the context or
if the current context is already commited.delete(Object)
void delete(Object o)
throws PersistenceException,
RollbackException
o - the object to delete.
PersistenceException - if the object don't depends on
the current context or if the current context is already commited.
RollbackException - if the transaction is rollbacked.create(Class)
void commit()
throws PersistenceException,
RollbackException
delete all objects was need to be deleted.
A persistent object is an object returned by
findAll(Class) or findById(long, Class)
or explicitely made persistent using create(Class).
PersistenceException - if the manager that creates this context is closed,
if the current context is already commited.
RollbackException - if the transaction is rollbacked.
void rollback()
throws PersistenceException,
RollbackException
RollbackException.
PersistenceException - if the manager that creates this context is closed
RollbackException - is the context can be rollbacked.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||