1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package javax.jdo;
24
25 /** A <code>PersistenceCapable</code> class that provides callback methods for life
26 * cycle events implements this interface.
27 *
28 * <P>For JDO 2.0, <code>InstanceCallbacks</code> has been refactored to extend
29 * four other interfaces, without changing any of the methods or semantics.
30 * This allows fine-grained control over callbacks, for
31 * example to allow a class to implement the load callback without
32 * implementing any of the other callbacks. For backward compatibility
33 * with JDO 1.0, the <code>InstanceCallbacks</code> interface is preserved.
34 *
35 * <P>Classes which include non-persistent fields whose values depend
36 * on the values of persistent fields require callbacks on specific
37 * JDO instance life cycle events in order to correctly populate the
38 * values in these fields.
39 *
40 * <P>The callbacks might also be used if the persistent instances
41 * need to be put into the runtime infrastructure of the application.
42 * For example, a persistent instance might notify other instances
43 * on changes to state. The persistent instance might be in a list of
44 * managed instances. When the persistent instance is made hollow,
45 * it can no longer generate change events, and the persistent
46 * instance should be removed from the list of managed instances.
47 *
48 * <P>To implement this, the application programmer would implement
49 * <code>jdoPostLoad</code> to put itself into the list of managed
50 * instances, and implement <code>jdoPreClear</code> to remove itself from
51 * the list. With JDO 1.0, the domain class would be declared to implement
52 * <code>InstanceCallbacks</code>. With JDO 2.0, the domain class
53 * would be declared to implement
54 * <code>javax.jdo.listener.LoadCallback</code> and
55 * <code>javax.jdo.listener.ClearCallback</code>.
56 *
57 * <P>Note that JDO does not manage the state of non-persistent
58 * fields, and when a JDO instance transitions to hollow, JDO clears
59 * the persistent fields. It is the programmer's responsibility to
60 * clear non-persistent fields so that garbage collection of
61 * referred instances can occur.
62 *
63 * @since 1.0
64 * @version 2.0
65 */
66 public interface InstanceCallbacks
67 extends javax.jdo.listener.ClearCallback,
68 javax.jdo.listener.DeleteCallback,
69 javax.jdo.listener.LoadCallback,
70 javax.jdo.listener.StoreCallback {
71 }