Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne
Class PersistenceState

    java.lang.Object
      org.apache.cayenne.PersistenceState

    public class PersistenceState

extends Object

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
`static int` | `COMMITTED` Describes a state of an object registered with DataContext/ObjectContext, whose fields exactly match the state of a corresponding database row.
`static int` | `DELETED` Describes a state of an object registered with DataContext/ObjectContext, that will be deleted from the database on the next commit.
`static int` | `HOLLOW` Describes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row.
`static int` | `MODIFIED` Describes a state of an object registered with DataContext/ObjectContext, and having a corresponding database row.
`static int` | `NEW` Describes a state of an object freshly registered with DataContext/ObjectContext, but not committed to the database yet.
`static int` | `TRANSIENT` Describes a state of an object not registered with DataContext/ObjectContext, and therefore having no persistence features.

Constructor Summary
`PersistenceState()`

Method Summary
`static String` | `persistenceStateName(int persistenceState)` Returns String label for persistence state.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TRANSIENT

    public static final int TRANSIENT

  Describes a state of an object not registered with DataContext/ObjectContext, and therefore having no persistence features.

  See Also:
    Constant Field Values

### NEW

    public static final int NEW

  Describes 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:
    Constant Field Values

### COMMITTED

    public static final int COMMITTED

  Describes 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:
    Constant Field Values

### MODIFIED

    public static final int MODIFIED

  Describes 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:
    Constant Field Values

### HOLLOW

    public static final int HOLLOW

  Describes 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:
    Constant Field Values

### DELETED

    public static final int DELETED

  Describes a state of an object registered with DataContext/ObjectContext, that will be deleted from the database on the next commit.

  See Also:
    Constant Field Values

Constructor Detail

### PersistenceState

    public PersistenceState()

Method Detail

### persistenceStateName

    public static String persistenceStateName(int persistenceState)

  Returns String label for persistence state. Used for debugging.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.