1 package com.triactive.jdo.test; 2 3 import javax.jdo.InstanceCallbacks; 4 5 public class InstanceCallbackTester implements InstanceCallbacks 6 { 7 private String persistentValue; 8 private String transientValue; 9 public static final String POST_LOAD_VALUE="loaded"; 10 11 public void setTransientValue(String s) 12 { 13 this.transientValue = s; 14 } 15 16 public String getTransientValue() 17 { 18 return this.transientValue; 19 } 20 21 public void setPersistentValue(String s) 22 { 23 this.persistentValue = s; 24 } 25 26 public String getPersistentValue() 27 { 28 return this.persistentValue; 29 } 30 31 public void jdoPostLoad() 32 { 33 setTransientValue(POST_LOAD_VALUE); 34 } 35 36 public void jdoPreStore() 37 { 38 setPersistentValue(getTransientValue()); 39 } 40 41 public void jdoPreClear() 42 { 43 } 44 45 public void jdoPreDelete() 46 { 47 if (this.transientValue == null) 48 throw new PreDeleteException(); 49 } 50 } 51 52 | Popular Tags |