int origIntValue1 = 10, origIntValue2 = 12;
float origFloatValue1 = 2.5f, origFloatValue2 = -3.0f;
// create two instances
InstanceCallbackNonPersistFdsClass obj1 = new InstanceCallbackNonPersistFdsClass(origFloatValue1, origIntValue1);
pm.makePersistent(obj1);
Object objPtr1 = pm.getObjectId (obj1);
obj1.setNonPersist(5, (char)10, .25, (short)100);
expectedIntValue1 = obj1.calcIntValue();
expectedFloatValue1 = obj1.calcFloatValue();
InstanceCallbackNonPersistFdsClass obj2 = new InstanceCallbackNonPersistFdsClass(origFloatValue2, origIntValue2);
pm.makePersistent(obj2);
Object objPtr2 = pm.getObjectId (obj2);
obj2.setNonPersist(2, (char)125, .1, (short)750);
expectedIntValue2 = obj2.calcIntValue();
expectedFloatValue2 = obj2.calcFloatValue();
t.commit();
t.begin();
// read both objects back in to determine persistent state is as expected.
try {
obj1 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr1, true);
checkValues("Object1 created and read back in: ", origIntValue1, expectedIntValue1, obj1.intValue);
checkValues("Object1 created and read back in: ", origFloatValue1, expectedFloatValue1, obj1.floatValue);
origIntValue1 = obj1.intValue;
origFloatValue1 = obj1.floatValue;
obj1.setNonManaged(-1, (char)62);
expectedIntValue1 = obj1.calcIntValue();
expectedFloatValue1 = obj1.calcFloatValue();
} catch (JDOUserException e) {
// could not locate persistent object created in previous transaction
fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
return;
} catch (JDODataStoreException e) {
// could not locate persistent object created in previous transaction
fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj1 created in previous transaction, got " + e);
return;
}
try {
obj2 = (InstanceCallbackNonPersistFdsClass)pm.getObjectById(objPtr2, true);
checkValues("Object2 created and read back in: ", origIntValue2, expectedIntValue2, obj2.intValue);
checkValues("Object2 created and read back in: ", origFloatValue2, expectedFloatValue2, obj2.floatValue);
origIntValue2 = obj2.intValue;
origFloatValue2 = obj2.floatValue;
obj2.setNonPersist(12, (char)30, 5.0, (short)137);
expectedIntValue2 = obj2.calcIntValue();
expectedFloatValue2 = obj2.calcFloatValue();
// change obj2 making it persistent dirty (leave obj1 persistent clean).
obj2.incrementIntValue();
} catch (JDOUserException e) {
// could not locate persistent object created in previous transaction
fail(ASSERTION_FAILED, "CallingJdoPrestore: Failed to find object obj2 created in previous transaction, got " + e);
return;
} catch (JDODataStoreException e) {