Examples of detachCopy()


Examples of javax.jdo.PersistenceManager.detachCopy()

      // Lazily load administrator list
      chapter.getAdministrators();

      // Detach chapter
      chapter = pm.detachCopy(chapter);
    } catch (JDOObjectNotFoundException e) {
      return null;
    } finally {
      pm.close();
    }
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

      pm.getFetchPlan().setMaxFetchDepth(maxFetchDepth);
      if (fetchGroups != null)
        pm.getFetchPlan().setGroups(fetchGroups);

      return pm.detachCopy(order);
    } finally {
      pm.close();
    }
  }
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

      }
      pm.getFetchPlan().setMaxFetchDepth(maxFetchDepth);
      if (fetchGroups != null)
        pm.getFetchPlan().setGroups(fetchGroups);

      return pm.detachCopy(offer);
    } finally {
      pm.close();
    }
  }
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.currentTransaction().begin();
    pm.makePersistent(share1);
    pm.makePersistent(share2);
    pm.currentTransaction().commit();
   
    Share copyOfShare = (Share) pm.detachCopy((Object)share1);
    logger.log(BasicLevel.DEBUG, "share detached");
    SharePrice price = copyOfShare.getPrice(12,2004,11);
    if (price != null) {
        price.setPrice(new BigDecimal(99000));
    }
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

   
    FetchPlan f = pm.getFetchPlan();
    logger.log(BasicLevel.DEBUG, "FG: " + f.getGroups());
   
    pm.currentTransaction().begin();
    Thesis detachedT3 = (Thesis) pm.detachCopy(thesis3);
    try{
      assertEquals(thesis3.getIsbn(), detachedT3.getIsbn());
      assertEquals(thesis3.getType(), detachedT3.getType());
      assertEquals(thesis3.getPageNb(), detachedT3.getPageNb());
      assertEquals(thesis3.getAuthor().getFirstName(), detachedT3.getAuthor().getFirstName());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    try {
      //detach the team t
      Team copyOfT = (Team) pm.detachCopy(t);
      assertNotNull(copyOfT);
      //print the team out
      logger.log(BasicLevel.DEBUG, copyOfT.toString());
      pm.currentTransaction().begin();
      //attach the team t
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //modify the team
    copyOfT.getCoach().setExperience(99);
    //print the team out
    logger.log(BasicLevel.DEBUG, "Copy of team " + copyOfT.toString());
    pm.currentTransaction().begin();
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    try {
      //detach the team t
      Team copyOfT = (Team) pm.detachCopy(t);
      Coach newCoach = new Coach("c33", 15, new Team("DummyTeam",null,null));
      //  update the reference while detached
      copyOfT.setCoach(newCoach);
      //print the team out
      logger.log(BasicLevel.DEBUG, "Copy of team " + copyOfT.toString());
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    pm.close();
    //modify the coach
    copyOfT.getCoach().setExperience(99);
    //and modify the collection
    Iterator it = copyOfT.getPlayers().iterator();
View Full Code Here

Examples of javax.jdo.PersistenceManager.detachCopy()

    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    try {
      //detach the team t
      Team copyOfT = (Team) pm.detachCopy(t);
      assertNotNull(copyOfT);
      assertNotNull("Coach of detached team should not be null.", copyOfT.getCoach());
      //set null for the coach
      copyOfT.setCoach(null);
      assertNull(copyOfT.getCoach());
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.