Provides callbacks from the Session to the persistent object.
Persistent classes may implement this interface but they are not
required to.
onSave: called just before the object is saved onUpdate: called just before an object is updated,
ie. when Session.update() is called onDelete: called just before an object is deleted onLoad: called just after an object is loaded
onSave(), onDelete() and onUpdate() are intended
to be used to cascade saves and deletions of dependent objects. This is an
alternative to declaring cascaded operations in the mapping file.
onLoad() may be used to initialize transient properties of the
object from its persistent state. It may not be used to load
dependent objects since the Session interface may not be
invoked from inside this method.
A further intended usage of onLoad(), onSave() and
onUpdate() is to store a reference to the Session
for later use.
If onSave(), onUpdate() or onDelete() return
VETO, the operation is silently vetoed. If a
CallbackException is thrown, the operation is vetoed and the
exception is passed back to the application.
Note that onSave() is called after an identifier is assigned
to the object, except when identity column key generation is used.
onSave: called just before the object is saved
onUpdate: called just before an object is updated, ie. when Session.update() is called
onDelete: called just before an object is deleted
onLoad: called just after an object is loaded
onSave(), onDelete() and onUpdate() are intended to be used to cascade saves and deletions of dependent objects. This is an alternative to declaring cascaded operations in the mapping file.
onLoad() may be used to initialize transient properties of the object from its persistent state. It may not be used to load dependent objects since the Session interface may not be invoked from inside this method.
A further intended usage of onLoad(), onSave() and onUpdate() is to store a reference to the Session for later use.
If onSave(), onUpdate() or onDelete() return VETO, the operation is silently vetoed. If a CallbackException is thrown, the operation is vetoed and the exception is passed back to the application.
Note that onSave() is called after an identifier is assigned to the object, except when identity column key generation is used.