dbHelper.deleteAll("MT_TABLE1");
}
public void testValidate() throws Exception {
ClientMtTable1 o1 = context.newObject(ClientMtTable1.class);
o1.setGlobalAttribute1("G1");
o1.resetValidation(false);
// this one is not validating
ClientMtTable2 o2 = context.newObject(ClientMtTable2.class);
o2.setTable1(o1);
context.commitChanges();
assertTrue(o1.isValidatedForInsert());
assertFalse(o1.isValidatedForDelete());
assertFalse(o1.isValidatedForUpdate());
o1.resetValidation(false);
o1.setGlobalAttribute1("G2");
context.commitChanges();
assertFalse(o1.isValidatedForInsert());
assertFalse(o1.isValidatedForDelete());
assertTrue(o1.isValidatedForUpdate());
o1.resetValidation(false);
context.deleteObject(o1);
context.deleteObject(o2);
context.commitChanges();
assertFalse(o1.isValidatedForInsert());
assertTrue(o1.isValidatedForDelete());
assertFalse(o1.isValidatedForUpdate());
ClientMtTable1 o11 = context.newObject(ClientMtTable1.class);
o11.setGlobalAttribute1("G1");
o11.resetValidation(true);
try {
context.commitChanges();
fail("Validation failure must have prevented commit");
}