*/
public void testVersion7() {
logger.log(BasicLevel.DEBUG, "***************testVersion7*****************");
Team t = new Team("T7",null,null);
Collection players = new ArrayList();
Player p1 = new Player("p13", t, 20);
players.add(p1);
Player p2 = new Player("p14", t, 30);
players.add(p2);
t.setPlayers(players);
Coach c = new Coach("c7", 10, t);
t.setCoach(c);
PersistenceManager pm = pmf.getPersistenceManager();
pm.currentTransaction().begin();
pm.makePersistent(t);
pm.currentTransaction().commit();
//begin
pm.currentTransaction().begin();
//detach the team t
Team copyOfT1 = (Team) pm.detachCopy(t);
//detach the team t
Team copyOfT2 = (Team) pm.detachCopy(t);
//commit
pm.currentTransaction().commit();
//modify the copy1
copyOfT1.getCoach().setExperience(99);
Iterator it = copyOfT1.getPlayers().iterator();
//modify the players
while(it.hasNext()){
Player p = (Player) it.next();
p.setAge(99);
}
//modify the copy2
copyOfT2.getCoach().setExperience(99);
it = copyOfT2.getPlayers().iterator();
//modify the players
while(it.hasNext()){
Player p = (Player) it.next();
p.setAge(99);
}
boolean attach1OK = false;
try{
pm.currentTransaction().begin();