Package ch.ivyteam.ivy.persistence

Persistency layer interface of Axon.ivy. All persistency functionality of Axon.ivy should be done with the interfaces defined in this package. Entry point for the persistency user is the persistency manager. Users can get a persistency service from the persistency manager. The persistency service can register or unregister itself on the persistency manager. Examples of persistency services are database persistency service, file persistency service etc. Users can get a class persistency service from a persistency service. The class persistency service provides CRUD functions to create, read, update and delete a persistent object. The methods of class persistency service never return a persistent object direct, instead they return persistent object handles. The persistent object can be get from the persistent object handle with the method getObject. This behavior allows that the user or a cache implementor invalidates the handle, if the persistent object has changed on the persistency service. The next time the user gets the persistent object from the handle the persistent object will be reread from the persistency service. The user does not know if the handle returns the persistent object direct or reads it from the persistency service. The class of a persistent object must implement the interface IPersistentObject if that object has a persistent parent object the class must also implement the interface IPersistentChildObject. Note that it is a good idea that a persistent object is a clean data object without any functionality. The object should be immutable. Every method that change the data of the object should not modify the data instead a new object with the modified data should be returned. Mostly every method on the class persistency service needs a persistent transaction. A persistent transaction can be started with the Method startTransaction either on the class persistency service or on the persistency service. A persistent transaction must be committed otherwise the changes may not be stored. A persistent transaction can also be rollbacked in case of errors. On a persistent transaction, persistent transaction commands can be executed. The methods of the persistent transaction command are called on certain events of the persistent transaction The user can add a listener to a class persistency service. In this case he will be informed if an object is created, written or deleted.