tx.begin();
List<Dn2id> updatedInstances = new ArrayList<Dn2id>();
for (int i = 0; i < NUMBER_OF_INSTANCES; ++i) {
dn2idPK[1] = getA1for(NUMBER_OF_INSTANCES, i);
dn2idPK[3] = "employeenumber=100000" + i;
Dn2id d = session.find(Dn2id.class, dn2idPK);
// verify eid
long expected = i;
long actual = d.getEid();
if (expected != actual) {
error("Failed to find dn2id " + i
+ " expected eid " + expected
+ " actual eid " + actual);
}
// now update the eid field
d.setEid(NUMBER_OF_INSTANCES + d.getEid());
updatedInstances.add(d);
}
session.updatePersistentAll(updatedInstances);
tx.commit();
// now find and verify
tx.begin();
for (int i = 0; i < NUMBER_OF_INSTANCES; ++i) {
dn2idPK[1] = getA1for(NUMBER_OF_INSTANCES, i);
dn2idPK[3] = "employeenumber=100000" + i;
Dn2id d = session.find(Dn2id.class, dn2idPK);
// verify eid
long expected = NUMBER_OF_INSTANCES + i;
long actual = d.getEid();
if (expected != actual) {
error("Failed to find updated dn2id " + i
+ " expected eid " + expected
+ " actual eid " + actual);
}