Object States and Life Cycle

Objects of persistent classes can either be transient or persistent. While being transient they behave just like normal .NET objects. An object is made persistent with the PersistenceManager function MakePersistent() and can be saved and restored afterwards. Calling MakeTransient() removes a persistent object from the management of the PersistenceManager.

While managed by the PersistenceManager an object can have one of the following states:

 

Transient

Objects are transient after creation with new.

Created

Objects are created after MakePersistent() was called. After that call objects are managed by NDO. But they are not being written to the database before Save() is called.

Persistent

Objects are in this state if they have a presentation in the database and have not been altered.

Deleted

Objects are in this state after Delete() was called. Save() finally deletes the objects from the database.

PersistentDirty

Such objects have a presentation in the database and have been changed in memory so that a write operation to the database is necessary.

Hollow

Objects are in this state if only the ObjectId was loaded from the database into memory. The object data are not loaded before the first access to one of its persistent fields. If a PersistenceManager is operated in HollowMode, all objects are transferred into Hollow state after a transaction has been ended with Abort() or Save().