Transaction tx = pm.currentTransaction();
int i, n;
Integer firstValue = new Integer(Integer.MIN_VALUE);
Integer secondValue = new Integer(Integer.MAX_VALUE);
tx.begin();
FieldsOfInteger pi = new FieldsOfInteger();
pi.identifier = 1;
pm.makePersistent(pi);
Object oid = pm.getObjectId(pi);
n = pi.getLength();
// Provide initial set of values
for( i = 0; i < n; ++i){
pi.set( i, firstValue);
}
tx.commit();
// cache will be flushed
pi = null;
System.gc();
tx.begin();
pi = (FieldsOfInteger) pm.getObjectById(oid, true);
checkValues(oid, firstValue);
// Provide new set of values
for( i = 0; i < n; ++i){
pi.set(i, secondValue);
}
tx.commit();
// cache will be flushed
pi = null;
System.gc();