* Test the detach method with a persistent-dirty object: the object is flushed before being detached.
*/
public void testDetachPersistentDirty() {
logger.log(BasicLevel.DEBUG, "******************testDetachPersistentDirty****************");
Team t = new Team("Nantes",null,null);
Coach c = new Coach("c4", 5, t);
t.setCoach(c);
Player p = new Player("p5", t, 28);
t.addPlayer(p);
PersistenceManager pm = pmf.getPersistenceManager();
//make persistent
pm.currentTransaction().begin();
pm.makePersistent(c);
pm.currentTransaction().commit();
//update and detach
pm.currentTransaction().begin();
c.setExperience(10);
//detach the team while it is persistent-dirty: the object must be flushed before being detached
Team copyOfT = (Team) pm.detachCopy(t);
pm.currentTransaction().commit();
try {
assertEquals(10, copyOfT.getCoach().getExperience());