Package org.apache.cayenne
Class PersistenceState
java.lang.Object
org.apache.cayenne.PersistenceState
Defines a set of object states from the point of view of persistence. I.e.
PersistenceState is the state of data stored in an object relative to the external
persistence store. If an object's state matches the state of the persistence store, the
object is COMMITTED. If object is not intended to be persistent or is not explicitly
made persistent, the state is TRANSIENT, and so on.
Object persistence states should not be modified directly. Rather it is a responsibility of a ObjectContext/DataContext to maintain correct state of the managed objects.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Describes a state of an object registered with DataContext/ObjectContext, whose fields exactly match the state of a corresponding database row.static final int
Describes a state of an object registered with DataContext/ObjectContext, that will be deleted from the database on the next commit.static final int
Describes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row.static final int
Describes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row.static final int
Describes a state of an object freshly registered with DataContext/ObjectContext, but not committed to the database yet.static final int
Describes a state of an object not registered with DataContext/ObjectContext, and therefore having no persistence features. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
persistenceStateName
(int persistenceState) Returns String label for persistence state.
-
Field Details
-
TRANSIENT
public static final int TRANSIENTDescribes a state of an object not registered with DataContext/ObjectContext, and therefore having no persistence features.- See Also:
-
NEW
public static final int NEWDescribes a state of an object freshly registered with DataContext/ObjectContext, but not committed to the database yet. So there is no corresponding database record for this object just yet.- See Also:
-
COMMITTED
public static final int COMMITTEDDescribes a state of an object registered with DataContext/ObjectContext, whose fields exactly match the state of a corresponding database row. This state is not fully "clean", since database record may have been externally modified.- See Also:
-
MODIFIED
public static final int MODIFIEDDescribes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row. This object state is known to be locally modified and different from the database state.- See Also:
-
HOLLOW
public static final int HOLLOWDescribes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row. This object does not store any fields except for its id (it is "hollow"), so next time it is accessed, it will be populated from the database by the context. In this respect this is a real "clean" object.- See Also:
-
DELETED
public static final int DELETEDDescribes a state of an object registered with DataContext/ObjectContext, that will be deleted from the database on the next commit.- See Also:
-
-
Constructor Details
-
PersistenceState
public PersistenceState()
-
-
Method Details
-
persistenceStateName
Returns String label for persistence state. Used for debugging.
-