ID
- is the type of the primary key
.public interface PersistenceEntity<ID> extends RevisionedEntity<ID>
RevisionedEntity
that represents an entity of the
persistence. Unlike TransferObject
s such object may be
in STATE_MANAGED
and is connected with a persistent store. Typically this will happen using JPA
and an RDBMS. In this case classes implementing this interface will have JPA annotations
and gets managed
by an EntityManager
. final
except you exactly know what you are doing.
Additionally getClass()
may return a subclass of your entity that you never
created (see PersistenceManager
in mmm-persistence
for additional information and
support).Modifier and Type | Field and Description |
---|---|
static String |
STATE_DETACHED
|
static String |
STATE_MANAGED
A
PersistenceEntity becomes managed when it is
persisted or in case it is directly
retrieved from the persistent store
(database). |
static String |
STATE_NEW
A
PersistenceEntity is in the new (or transient) state when it is manually created via
its constructor (using new ). |
static String |
STATE_REMOVED
If
remove is called on a managed entity, its state changes to removed and the entity will be deleted from the
persistent store whenever the transaction is committed. |
LATEST_REVISION
getRevision
getId, getModificationCounter
static final String STATE_NEW
PersistenceEntity
is in the new (or transient) state when it is manually created via
its constructor (using new
). In this state it can be considered as a regular java-object.
Whenever persist
or even
merge
is called, the state of the entity changes to
managed
.static final String STATE_MANAGED
PersistenceEntity
becomes managed when it is
persisted
or in case it is directly
retrieved
from the persistent store
(database). It will remain in the managed state until a state change is explicitly triggered via
detach
/
remove
or in case the transaction is committed. static final String STATE_REMOVED
remove
is called on a managed
entity, its state changes to removed
and the entity will be deleted from the
persistent store whenever the transaction is committed.static final String STATE_DETACHED
detach
is called on a managed
entity, its state changes to detached
. The same applies of the transaction is
committed or on manual invocations of clear
or
close
. lazy
and has not been fetched
previously, calls to get this property will cause an exception. A detached entity can change its state
back to managed
via merge
.Copyright © 2001–2014 mmm-Team. All rights reserved.