Business Components

oracle.jbo.server
Interface Entity

All Known Implementing Classes:
EntityImpl

public interface Entity
extends Row, ValidationListener, ValidationManager, oracle.jbo.server.TransactionManager, TransactionListener, TransactionPostListener

Defines the middle-tier representation of database rows.

An Entity Object provides an object-oriented representation of the data it caches from a database object, such as a table or view. Database rows are presented as individual Entity Objects, in which attributes typically correspond to columns in the corresponding table.

The status of an Entity Object, relative to the corresponding database data, is indicated by its current post-state and entity-state.

States are set to one of STATUS_NEW, STATUS_MODIFIED, STATUS_DELETED and STATUS_DEAD by create, update, delete, and rollback operations, respectively. These operations can set both the post-state and the entity-state.

Post-states indicate the state of the Entity Object's data relative to the transaction's corresponding database data. The post-state is reset to STATUS_UNMODIFIED when a post operation is invoked.

Entity-states indicate the state of the Entity Object's data relative to the actual database data, and the state of the transaction itself. The entity-state is reset to STATUS_UNMODIFIED by a commit or a rollback operation.

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_NEW
          Indicates that the Entity Object's row is newly created.
static byte STATUS_UNMODIFIED
          Indicates that the Entity Object's row is unchanged or has been updated.
 
Fields inherited from interface oracle.jbo.XMLInterface
XML_OPT_ALL_ROWS, XML_OPT_ASSOC_CONSISTENT, XML_OPT_CHANGES_ONLY, XML_OPT_LIMIT_RANGE
 
Method Summary
 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 revert()
          Reverts this Entity Object's row to the database's values.
 
Methods inherited from interface oracle.jbo.Row
getKey, isAttributeUpdateable, lock, remove, validate
 
Methods inherited from interface oracle.jbo.server.ValidationManager
addToValidationListeners
 
Methods inherited from interface oracle.jbo.server.TransactionManager
addTransactionPostListener, addTransactionPostListenerNoCheck, removeTransactionPostListener
 
Methods inherited from interface oracle.jbo.server.TransactionListener
afterCommit, afterRemove, afterRollback, beforeCommit, beforeRollback, isTransientTransactionListener
 
Methods inherited from interface oracle.jbo.server.TransactionPostListener
getTransPostHandle, isTransientTransactionPostListener, postChanges, setTransPostHandle
 
Methods inherited from interface oracle.jbo.AttributeList
getAttribute, getAttribute, getAttributeCount, getAttributeIndexOf, setAttribute, setAttribute
 
Methods inherited from interface oracle.jbo.XMLInterface
readXML, readXML, writeXML, writeXML
 

Field Detail

STATUS_NEW

public static final byte STATUS_NEW
Indicates that the Entity Object's row is newly created.

STATUS_UNMODIFIED

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

STATUS_MODIFIED

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

STATUS_DELETED

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

STATUS_DEAD

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

isValid

public 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

public 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

public 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

public 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

public 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

public 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)

Business Components