A lifecycle of a persistent object can be represented as a number of states and transitions between them. These states are formally defined as "int" constants in org.objectstyle.cayenne.PersistenceState class. Transitions between states (see the diagram below) occur in response to the application interacting with either persistent objects or Cayenne context. Whenever a transition occurs, Cayenne automatically updates "persistenceState" property of all affected objects by calling setPersistenceState().

A new object state transformations:

A feteched or committed object state transformations: