PersistenceManager pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
pm.makePersistent(c);
//detach the team while it is persistent-new: the object must be flushed before being detached
Team copyOfT = (Team) pm.detachCopy(t);
try {
assertNotNull(copyOfT);
assertEquals("Town of team and detached team are not the same", t.getTown(), copyOfT.getTown());
assertEquals("Coach experience of team and detached team are not the same",t.getCoach().getExperience(), copyOfT.getCoach().getExperience());
assertEquals("Coach name of team and detached team are not the same",t.getCoach().getName(), copyOfT.getCoach().getName());