01: package com.triactive.jdo.test;
02:
03: import javax.jdo.InstanceCallbacks;
04:
05: public class InstanceCallbackTester implements InstanceCallbacks {
06: private String persistentValue;
07: private String transientValue;
08: public static final String POST_LOAD_VALUE = "loaded";
09:
10: public void setTransientValue(String s) {
11: this .transientValue = s;
12: }
13:
14: public String getTransientValue() {
15: return this .transientValue;
16: }
17:
18: public void setPersistentValue(String s) {
19: this .persistentValue = s;
20: }
21:
22: public String getPersistentValue() {
23: return this .persistentValue;
24: }
25:
26: public void jdoPostLoad() {
27: setTransientValue(POST_LOAD_VALUE);
28: }
29:
30: public void jdoPreStore() {
31: setPersistentValue(getTransientValue());
32: }
33:
34: public void jdoPreClear() {
35: }
36:
37: public void jdoPreDelete() {
38: if (this .transientValue == null)
39: throw new PreDeleteException();
40: }
41: }
|