Package org.objectweb.speedo.pobjects.detach

Examples of org.objectweb.speedo.pobjects.detach.Coach


    Player p1 = new Player("p1", t, 25);
    players.add(p1);
    Player p2 = new Player("p2", t, 32);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c1", 5, t);
    t.setCoach(c);
   
    Team t2 = new Team("Nantes", null, null);
    Collection players2 = new ArrayList();
    Player p3 = new Player("p3", t2, 25);
    players2.add(p3);
    Player p4 = new Player("p4", t2, 32);
    players2.add(p4);
    t2.setPlayers(players2);
    Coach c2 = new Coach("c2", 5, t2);
    t2.setCoach(c2);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
View Full Code Here


    Player p1 = new Player("p1", t, 25);
    players.add(p1);
    Player p2 = new Player("p2", t, 32);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c1", 5, t);
    t.setCoach(c);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the team " + t.toString());
View Full Code Here

    * Test the detach method with a non persistent object: the object is made persistent before being detached.
    */
  public void testDetachNonPersistentCopy() {
    logger.log(BasicLevel.DEBUG, "*************testDetachNonPersistentCopy*****************");
    Team t = new Team("Marseille",null,null);
    Coach c = new Coach("c2", 5, t);
    t.setCoach(c);
    Player p = new Player("p3", t, 25);
    t.addPlayer(p);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
View Full Code Here

    * Test the detach method with a persistent-new object: the object is flushed before being detached.
    */
  public void testDetachPersistentNew() {
    logger.log(BasicLevel.DEBUG, "******************testDetachPersistentNew****************");
    Team t = new Team("Monaco",null,null);
    Coach c = new Coach("c3", 5, t);
    t.setCoach(c);
    Player p = new Player("p4", t, 25);
    t.addPlayer(p);
   
    PersistenceManager pm = pmf.getPersistenceManager();
View Full Code Here

    * Test the detach method with a persistent-dirty object: the object is flushed before being detached.
    */
  public void testDetachPersistentDirty() {
    logger.log(BasicLevel.DEBUG, "******************testDetachPersistentDirty****************");
    Team t = new Team("Nantes",null,null);
    Coach c = new Coach("c4", 5, t);
    t.setCoach(c);
    Player p = new Player("p5", t, 28);
    t.addPlayer(p);
       
    PersistenceManager pm = pmf.getPersistenceManager();
    //make persistent
    pm.currentTransaction().begin();
    pm.makePersistent(c);
    pm.currentTransaction().commit();
    //update and detach
    pm.currentTransaction().begin();
    c.setExperience(10);
    //detach the team while it is persistent-dirty: the object must be flushed before being detached
    Team copyOfT = (Team) pm.detachCopy(t);
    pm.currentTransaction().commit();
    try {
      assertEquals(10, copyOfT.getCoach().getExperience());
View Full Code Here

    * Test the detach method with a persistent-deleted object: an exception must be thrown.
    */
  public void testDetachPersistentDeleted() {
    logger.log(BasicLevel.DEBUG, "******************testDetachPersistentDeleted****************");
    Team t = new Team("Paris",null, null);
    Coach c = new Coach("c5", 5, t);
    t.setCoach(c);
    Player p = new Player("p6", t, 28);
    t.addPlayer(p);
   
    PersistenceManager pm = pmf.getPersistenceManager();
View Full Code Here

    * Test the detach method with a persistent-deleted object within a collection: an exception must be thrown.
    */
  public void testDetachPersistentDeletedCollection() {
    logger.log(BasicLevel.DEBUG, "******************testDetachPersistentDeletedCollection****************");
    Team t = new Team("Auxerre",null, null);
    Coach c = new Coach("c6", 10, t);
    t.setCoach(c);
    Player p = new Player("p7", t, 28);
    t.addPlayer(p);
   
    PersistenceManager pm = pmf.getPersistenceManager();
View Full Code Here

   */
  public void testNewReferencingDetached() {
    PersistenceManager pm = pmf.getPersistenceManager();
    try {
      logger.log(BasicLevel.DEBUG, "******************testNewReferencingDetached****************");
      Coach c = new Coach("cXX", 10, null);
      //make persistent the coach
      pm.currentTransaction().begin();
      pm.makePersistent(c);
      pm.currentTransaction().commit();
      //detach a copy
      Coach copyOfC = (Coach) pm.detachCopy(c);
      //create a team referencing the detached coach
      Team t = new Team("LeMans",null, null);
      t.setCoach(copyOfC);
      //make persistent the team
      pm.currentTransaction().begin();
View Full Code Here

    Player p1 = new Player("p1", t, 20);
    players.add(p1);
    Player p2 = new Player("p2", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c1", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
View Full Code Here

    Player p1 = new Player("p3", t, 20);
    players.add(p1);
    Player p2 = new Player("p4", t, 30);
    players.add(p2);
    t.setPlayers(players);
    Coach c = new Coach("c2", 10, t);
    t.setCoach(c);
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    pm.makePersistent(t);
    pm.currentTransaction().commit();
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.detach.Coach

Copyright © 2018 www.massapicom. 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.