Table of Contents
OTM Object States
OTM offers state management of entities. This means the applications only need to worry about letting OTM know about the objects that are to be persisted. OTM tracks the changes made to the objects and updates the triple-store and blob-store as needed.
State Definitions
- Transient - an object is transient if it has just been instantiated using the new operator, and it is not associated with an OTM Session. It has no persistent representation in the database and no identifier value has been assigned. Transient instances will be destroyed by the garbage collector if the application doesn't hold a reference anymore. Use the OTM Session to make an object persistent.
- Persistent - a persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session. OTM will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes.
- Detached - a detached instance is an object that has been persistent, but its Session has been closed. The reference to the object is still valid, of course, and the detached instance might even be modified in this state. A detached instance can be reattached to a new Session at a later point in time, making it (and all the modifications) persistent again.
- Deleted - a sub-state of Persistent. All objects marked for removal from the database are in this state. Objects are removed from the database only when the unit of work is completed.
State Transitions

