4.4. Callbacks

By implementing callback methods, an application can intercept some of the above lifecycle events. There are three major cases in which an application developer might wish to implement some special behavior of persistent classes. These cases are as follows:

  • Read or write data of fields that is not persistence-capable or should not be stored by the default JDO algorithm

  • Delete contained objects

  • Clear unneeded references

The callback methods are placed in an extra interface, which is handled like the java.io.Serializable tag interface. If a persistence-capable class implements the InstanceCallbacks interface, the callback methods are called by the JDO implementation; otherwise, they are not called.

4.4.1. Uses of jdoPostLoad

The

Get Core Java™ Data Objects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.