public interface Entity extends Row, ValidationListener, ValidationManager, TransactionListener, TransactionPostListener
An Entity Object provides an object-oriented representation of the data it caches from a persistence service (most commonly, RDBMS). For RDBMS, each database row is presented as individual Entity Object, in which attributes typically correspond to columns in the database table.
An Entity Object goes through different states based on client's actions. An Entity Object keeps two states: post-state and entity-state.
 States are set to one of STATUS_INITIALIZED, STATUS_NEW,
 STATUS_UNMODIFIED, STATUS_MODIFIED,
 STATUS_DELETED, or STATUS_DEAD by various
 row manipulation operations, e.g., create, update, delete, and rollback.
 These operations can change the post-state and the entity-state.
 
 The post-state indicates the state of the Entity Object relative to
 the last data posted row in the database.  The entity-state indicates
 the state of the Entity Object relative to the transaction itself.
 See STATUS_... constants for further discussions.
 
 An Entity Object is owned by its container.  A Entity Object container
 may be the Transaction object or the master Entity Object.
 The latter is the case if this Entity Object is a child (detail) Entity in
 a composition association.  In this case, the master Entity Object
 owns this Entity Object, and the master Entity Object is said to
 be the container.  The Entity Object container plays the role of
 a TransactionManager and ValidationManager
 for its children (containees).
 
When an Entity Object attribute values are modified, the container is notified. The container registers the modified Entity Object in its transaction-post-listener list and validation-listener list. The transaction-post-listener list is a list of objects that need to be posted to the underlying persistence service. The validation-listener list is a list of objects that need to be validated before they are written (posted) to the persistence service.
| Modifier and Type | Field and Description | 
|---|---|
| static byte | STATUS_DEADIndicates that the Entity Object is a new row that has been discarded. | 
| static byte | STATUS_DELETEDIndicates that the Entity Object's row has been deleted. | 
| static byte | STATUS_MODIFIEDIndicates that the Entity Object's row is changed. | 
| static byte | STATUS_UNMODIFIEDIndicates that the Entity Object's row is unchanged or has been updated. | 
EFFDT_DELETE_FUTURE_CHANGE_MODE, EFFDT_DELETE_MODE, EFFDT_DELETE_NEXT_CHANGE_MODE, EFFDT_DELETE_THIS_CHANGE_MODE, EFFDT_DELETE_ZAP_MODE, EFFDT_EXPERT_MODE, EFFDT_NONE_MODE, EFFDT_UPDATE_CHANGE_INSERT_MODE, EFFDT_UPDATE_CORRECTION, EFFDT_UPDATE_MODE, EFFDT_UPDATE_NEW_EARLIEST_CHANGE_MODE, EFFDT_UPDATE_OVERRIDE_MODE, REFRESH_CONTAINEES, REFRESH_FORGET_NEW_ROWS, REFRESH_REMOVE_NEW_ROWS, REFRESH_UNDO_CHANGES, REFRESH_WITH_DB_FORGET_CHANGES, REFRESH_WITH_DB_ONLY_IF_UNCHANGED, STATUS_INITIALIZED, STATUS_NEWXML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE, XML_PASSIVATION_USE| Modifier and Type | Method and Description | 
|---|---|
| void | addTransactionPostListener(TransactionPostListener listener) | 
| void | addTransactionPostListenerNoCheck(TransactionPostListener listener) | 
| byte | getEntityState()Gets this Entity Object's current entity-state. | 
| byte | getPostState()Gets this Entity Object's current post-state. | 
| Key | getPrimaryKey()Returns the primay key for this Entity Object's row. | 
| boolean | isLocked()Gets the status of the Entity Object's lock. | 
| boolean | isValid()Returns the state of this Entity Object's validity flag. | 
| void | removeTransactionPostListener(TransactionPostListener listener) | 
| void | revert()Reverts this Entity Object's row to the database's values. | 
getAttributeHints, getAttributeHints, getAttributeSecurityHints, getAttributeSecurityHints, getEffectiveDateMode, getKey, getSecurityHints, getStructureDef, isAttributeUpdateable, isDead, lock, refresh, remove, removeAndRetain, removeFromCollection, setAttributeValues, setEffectiveDateMode, setNewRowState, validategetAttribute, getAttribute, getAttributeCount, getAttributeIndexOf, getAttributeNames, getAttributeValues, setAttribute, setAttributereadXML, readXML, writeXML, writeXML, writeXML, writeXMLvalidateaddToValidationListeners, validateafterCommit, afterRemove, afterRollback, beforeCommit, beforeRollback, isTransientTransactionListenergetTransPostHandle, isPostedToDB, isTransientTransactionPostListener, postChanges, setPostedToDB, setTransPostHandlestatic final byte STATUS_UNMODIFIED
static final byte STATUS_MODIFIED
static final byte STATUS_DELETED
static final byte STATUS_DEAD
boolean isValid()
An Entity Object is marked valid if it has been validated and not subsequently modified or set invalid.
isValid in interface ValidationListenertrue if this Entity Object has been validated.Key getPrimaryKey()
Typically, this method should not be overridden.
boolean isLocked()
An Entity Object is locked if its corresponding database row is locked. This method should not be overridden.
true if this Entity Object is locked.byte getEntityState()
byte getPostState()
STATUS_UNMODIFIED -  if this Entity Object has been
          queried from the database and is unchanged,
           or if it has been posted to the database.STATUS_MODIFIED - if this Entity Object has been
           queried from the database and has changed.STATUS_NEW - if this Entity Object is new and
           not yet posted to the database.STATUS_DELETED - if this Entity Object
           has been marked for deletion.STATUS_DEAD -  if this Entity Object is
          new, but has been deleted.void revert()
Calling this method will either reset the attribute values
 to their database values or revert them to their default
 values. If the Entity Object is posted, all the attributes revert to the
 to unread state, so that a subsequent
 EntityImpl.getAttribute(int index) call
 will refresh all attributes from the database.
EntityImpl.getAttribute(int index)void addTransactionPostListener(TransactionPostListener listener)
void addTransactionPostListenerNoCheck(TransactionPostListener listener)
void removeTransactionPostListener(TransactionPostListener listener)