public void testCascadeDeleteOneToOne() {
PersistenceManager pm = pmf.getPersistenceManager();
// A president
String pName = "Boss";
President pres = new President(pName);
// A group
String gName = "SpeedoCascade";
Group grp = new Group(gName, pres);
pres.setGroup(grp);
// We make the group persistant
pm.makePersistent(grp);
// Get the ids
Object gId = pm.getObjectId(grp);
Object pId = pm.getObjectId(grp.getPresident());
pm.close();
grp = null;
pres = null;
// Check the creation of the group and its president
pm = pmf.getPersistenceManager();
grp = (Group) pm.getObjectById(gId, true);
pres = (President) pm.getObjectById(pId, true);
Assert.assertNotNull("null instance returned for group", grp);
Assert.assertEquals("Bad group name", gName, grp.getName());
Assert.assertNotNull("null instance returned for president", pres);
Assert.assertEquals("Bad president name", pName, pres.getName());
/* Delete the group :
* this should delete the president.
*/
pm.currentTransaction().begin();