public void runTest() throws Exception {
testDepends();
}
public void testDepends() throws Exception {
Database db = null;
MasterObjectNoKeyGen master = new MasterObjectNoKeyGen();
master.setId(100);
master.setDescrip("This is the descrip.");
db = _category.getDatabase();
db.begin();
db.create(master);
db.commit();
assertTrue(master.getId() != 0);
assertEquals(100, master.getId());
//THIS Part Works!
db.begin();
DependentObjectNoKeyGen depends = new DependentObjectNoKeyGen();
depends.setId(101);
depends.setDescrip("Description");
master.setDepends(depends);
db.update(master);
db.commit();
assertTrue(master.getId() != 0);
assertEquals(100, master.getId());
int masterId = master.getId();
db.begin();
master = (MasterObjectNoKeyGen) db.load(MasterObjectNoKeyGen.class, new Integer(
masterId));
assertNotNull(master.getDepends());
master.setDepends(null);
db.commit();
db.begin();
master = (MasterObjectNoKeyGen) db.load(MasterObjectNoKeyGen.class, new Integer(
masterId));
assertNull(master.getDepends());
db.commit();
//THIS part doesn't!
db.begin();
master = (MasterObjectNoKeyGen) db.load(MasterObjectNoKeyGen.class, new Integer(
masterId));
depends = new DependentObjectNoKeyGen();
depends.setId(102);
depends.setDescrip("Description");
master.setDepends(depends);
db.commit();
db.begin();
master = (MasterObjectNoKeyGen) db.load(MasterObjectNoKeyGen.class, new Integer(
masterId));
assertNotNull(master.getDepends());
db.commit();
db.begin();
master = (MasterObjectNoKeyGen) db.load(MasterObjectNoKeyGen.class, new Integer(
masterId));
assertNotNull(master);
db.remove(master);
db.commit();
}