Examples of detachCopy()


Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.makePersistent(t);
    pm.currentTransaction().commit();
   
    try {
      //detach the team
      Team copyOfT = (Team) pm.detachCopy(t);
      t = null;
      //create a new player
      String newPlayerName = "pXX";
      Player newPlayer = new Player(newPlayerName, copyOfT, 35);
      copyOfT.addPlayer(newPlayer);
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    logger.log(BasicLevel.DEBUG, "make persistent the formula one " + f.toString());
    pm.makePersistent(c);
    pm.makePersistent(f);
    pm.currentTransaction().commit();
    //detach the car c
    Car copyOfC = (Car) pm.detachCopy(c);
    //print the car out
    logger.log(BasicLevel.DEBUG, copyOfC.toString());
    //detach the formula one f
    FormulaOne copyOfF = (FormulaOne) pm.detachCopy(f);
    //print the formula one out
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    //detach the car c
    Car copyOfC = (Car) pm.detachCopy(c);
    //print the car out
    logger.log(BasicLevel.DEBUG, copyOfC.toString());
    //detach the formula one f
    FormulaOne copyOfF = (FormulaOne) pm.detachCopy(f);
    //print the formula one out
    logger.log(BasicLevel.DEBUG, copyOfF.toString());
    pm.currentTransaction().begin();
    //attach the copied car
    Car attachedCar = (Car) pm.makePersistent(copyOfC);
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the formula one " + f.toString());
    pm.makePersistent(f);
    pm.currentTransaction().commit();
    //detach
    FormulaOne copyOfF = (FormulaOne) pm.detachCopy(f);
    //modify
    copyOfF.setNbOfWheels(2);
    copyOfF.setSpeedMax(320);
    //print out
    logger.log(BasicLevel.DEBUG, "Copy of formula one " + copyOfF.toString());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.makePersistent(pocketNovel);
    pm.currentTransaction().commit();
   
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    Dictionnary detachedDictionnary = (Dictionnary) pm.detachCopy(dictionnary);
    try{
      assertEquals(dictionnary.getIsbn(), detachedDictionnary.getIsbn());
      assertEquals(dictionnary.getType(), detachedDictionnary.getType());
      assertEquals(dictionnary.getPageNb(), detachedDictionnary.getPageNb());
      assertEquals(dictionnary.getAuthor().getFirstName(), detachedDictionnary.getAuthor().getFirstName());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

      logger.log(BasicLevel.DEBUG, "Year can be accessed: " + detachedDictionnary.getYear());
      logger.log(BasicLevel.DEBUG, "Editor can be accessed: " + detachedDictionnary.getEditor().toString() + "\n");
    } catch(Exception e){
      fail("Detach failed: " + e.getMessage());
    }
    Novel detachedNovel = (Novel) pm.detachCopy(novel);
    try{
      assertEquals(novel.getIsbn(), detachedNovel.getIsbn());
      assertEquals(novel.getType(), detachedNovel.getType());
      assertEquals(novel.getPageNb(), detachedNovel.getPageNb());
      assertEquals(novel.getAuthor().getFirstName(), detachedNovel.getAuthor().getFirstName());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

        logger.log(BasicLevel.DEBUG, "Error: " + e);
        fail(e.getMessage());
      }
    }
   
    PocketNovel detachedPocketNovel = (PocketNovel) pm.detachCopy(pocketNovel);
    try{
      assertEquals(pocketNovel.getIsbn(), detachedPocketNovel.getIsbn());
      assertEquals(pocketNovel.getType(), detachedPocketNovel.getType());
      assertEquals(pocketNovel.getPageNb(), detachedPocketNovel.getPageNb());
      assertEquals(pocketNovel.getAuthor().getFirstName(), detachedPocketNovel.getAuthor().getFirstName());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

      m.put(d.getF1(), d);
    }
    pm.currentTransaction().commit();
   
    pm.getFetchPlan().addGroup("all").removeGroup("default");
    C copyOfC = (C) pm.detachCopy(c);
    assertEquals("Not the same id for c and its detached copy", c.getMyid(), copyOfC.getMyid());
    Map mC = c.getDkey2d();
    Map mCopyOfC = copyOfC.getDkey2d();
    assertEquals("The maps' size should be the same.",mC.size(), mCopyOfC.size());
    Iterator itC = mC.values().iterator();
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    assertEquals("The result of the query shouldn't be empty.", false, results.isEmpty());
    Team toDetach = (Team) results.iterator().next();
    query.closeAll();
   
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(toDetach);
    try {
      assertNotNull(copyOfT);
      assertEquals("Town of team and detached team are not the same", toDetach.getTown(), copyOfT.getTown());
      assertEquals("Coach experience of team and detached team are not the same",toDetach.getCoach().getExperience(), copyOfT.getCoach().getExperience());
      assertEquals("Coach name of team and detached team are not the same",toDetach.getCoach().getName(), copyOfT.getCoach().getName());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    Player p = new Player("p3", t, 25);
    t.addPlayer(p);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    //detach the team t while it is not persistent
    Team copyOfT = (Team) pm.detachCopy(t);
    pm.currentTransaction().commit();
    try {
      assertNotNull(copyOfT);
      assertTrue(((JDOPersistentObjectItf )t).jdoIsPersistent());
      //  print the team out
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.