Package javax.jdo

Examples of javax.jdo.PersistenceManager.detachCopy()


    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();
   
View Full Code Here


    //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);
View Full Code Here

    pm.currentTransaction().begin();
    pm.makePersistent(f);
    pm.currentTransaction().commit();
    try {
      //detach the formula one while it is persistent-new: the object must be flushed before being detached
      FormulaOne copyOfF = (FormulaOne) pm.detachCopy(f);
      assertEquals(f.getName(), copyOfF.getName());
      assertEquals(f.getColor(), copyOfF.getColor());
      assertEquals(f.getNbOfWheels(), copyOfF.getNbOfWheels());
      assertEquals(f.getType(), copyOfF.getType());
      assertEquals(f.getSpeedMax(), copyOfF.getSpeedMax());
View Full Code Here

    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();
   
View Full Code Here

    //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);
View Full Code Here

    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
View Full Code Here

        c.setProf(prof);
        c.setStudents(col);
        pm.currentTransaction().begin();
        pm.makePersistent(c);
        Object oid = pm.getObjectId(c);
        Course copyOfC = (Course) pm.detachCopy(c);
        pm.currentTransaction().commit();
        pm.close();
    File f = new File(new File(new File("output"),"test"), "testSerializeWithCollection");
    if (f.exists()) {
      f.delete();
View Full Code Here

    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
View Full Code Here

    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
    //detach the team t
    Team copyOfT = (Team) pm.detachCopy(t);
    //begin
    pm.currentTransaction().begin();
    //modify the coach
    t.getCoach().setExperience(99);
    Iterator it  = t.getPlayers().iterator();
View Full Code Here

    pm.currentTransaction().commit();
    pm.currentTransaction().begin();
    //modify
     f.setNbOfWheels(1);
     //detach the team t
    FormulaOne copyOfF = (FormulaOne) pm.detachCopy(f);
    //rollback the tx : it invalids the copy
    pm.currentTransaction().rollback();
    //  print out
    logger.log(BasicLevel.DEBUG, "Copy of f1 " + copyOfF.toString());
    logger.log(BasicLevel.DEBUG, "rollback of the tx: the attach shouldn't work.");
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.