Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

oracle.jbo.server
Interface Entity

All Superinterfaces:
AttributeList, java.util.EventListener, ExprWrappable, Row, TransactionListener, TransactionPostListener, ValidationListener, ValidationManager, XMLInterface
All Known Implementing Classes:
DSEntityImpl, EntityFacadeImpl, EntityImpl, EntityOverRow, RowIdEntityObjectImpl

public interface Entity
extends Row, ValidationListener, ValidationManager, TransactionListener, TransactionPostListener

This interface is for BC4J Entity Objects. Entity Object is responsible for managing data (attribute) values, updates to them, and interacting with the persistence service, e.g., RDBMS.

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.

Since:
JDeveloper 3.0

Field Summary
static byte STATUS_DEAD
          Indicates that the Entity Object is a new row that has been discarded.
static byte STATUS_DELETED
          Indicates that the Entity Object's row has been deleted.
static byte STATUS_MODIFIED
          Indicates that the Entity Object's row is changed.
static byte STATUS_UNMODIFIED
          Indicates that the Entity Object's row is unchanged or has been updated.
 
Fields inherited from interface oracle.jbo.Row
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_NEW
 
Fields inherited from interface oracle.jbo.XMLInterface
XML_IGNORE_DEPTH_COUNT, XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE, XML_PASSIVATION_USE
 
Method Summary
 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.
 
Methods inherited from interface oracle.jbo.Row
getAttributeHints, getAttributeHints, getAttributeSecurityHints, getAttributeSecurityHints, getEffectiveDateMode, getKey, getSecurityHints, getStructureDef, isAttributeUpdateable, isDead, lock, refresh, remove, removeAndRetain, removeFromCollection, setAttributeValues, setEffectiveDateMode, setNewRowState, validate
 
Methods inherited from interface oracle.jbo.AttributeList
getAttribute, getAttribute, getAttributeCount, getAttributeIndexOf, getAttributeNames, getAttributeValues, setAttribute, setAttribute
 
Methods inherited from interface oracle.jbo.XMLInterface
readXML, readXML, writeXML, writeXML, writeXML, writeXML
 
Methods inherited from interface oracle.jbo.server.ValidationListener
validate
 
Methods inherited from interface oracle.jbo.server.ValidationManager
addToValidationListeners, validate
 
Methods inherited from interface oracle.jbo.server.TransactionListener
afterCommit, afterRemove, afterRollback, beforeCommit, beforeRollback, isTransientTransactionListener
 
Methods inherited from interface oracle.jbo.server.TransactionPostListener
getTransPostHandle, isPostedToDB, isTransientTransactionPostListener, postChanges, setPostedToDB, setTransPostHandle
 

Field Detail

STATUS_UNMODIFIED

static final byte STATUS_UNMODIFIED
Indicates that the Entity Object's row is unchanged or has been updated.

See Also:
Constant Field Values

STATUS_MODIFIED

static final byte STATUS_MODIFIED
Indicates that the Entity Object's row is changed.

See Also:
Constant Field Values

STATUS_DELETED

static final byte STATUS_DELETED
Indicates that the Entity Object's row has been deleted.

See Also:
Constant Field Values

STATUS_DEAD

static final byte STATUS_DEAD
Indicates that the Entity Object is a new row that has been discarded.

See Also:
Constant Field Values
Method Detail

isValid

boolean isValid()
Returns the state of this Entity Object's validity flag. This predecate does not perform a validity test.

An Entity Object is marked valid if it has been validated and not subsequently modified or set invalid.

Specified by:
isValid in interface ValidationListener
Returns:
true if this Entity Object has been validated.

getPrimaryKey

Key getPrimaryKey()
Returns the primay key for this Entity Object's row. For example, if you are comparing two Entity Objects, you can compare the keys instead of comparing the Entities.

Typically, this method should not be overridden.

Returns:
the primary key.

isLocked

boolean isLocked()
Gets the status of the Entity Object's lock.

An Entity Object is locked if its corresponding database row is locked. This method should not be overridden.

Returns:
true if this Entity Object is locked.

getEntityState

byte getEntityState()
Gets this Entity Object's current entity-state. An Entity Object's state can be one of:

Returns:
one of STATUS_UNMODIFIED, STATUS_MODIFIED, STATUS_NEW, STATUS_DELETED, or STATUS_DEAD

getPostState

byte getPostState()
Gets this Entity Object's current post-state. The current post state can be one of:

Returns:
one of STATUS_UNMODIFIED, STATUS_MODIFIED, STATUS_NEW, STATUS_DELETED, or STATUS_DEAD

revert

void revert()
Reverts this Entity Object's row to the database's values.

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.

See Also:
EntityImpl.getAttribute(int index)

addTransactionPostListener

void addTransactionPostListener(TransactionPostListener listener)

addTransactionPostListenerNoCheck

void addTransactionPostListenerNoCheck(TransactionPostListener listener)

removeTransactionPostListener

void removeTransactionPostListener(TransactionPostListener listener)

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 2 (11.1.2.0.0)

E17483-01

Copyright © 1997, 2011, Oracle. All rights reserved.