Package org.objectweb.speedo.pobjects.ref

Examples of org.objectweb.speedo.pobjects.ref.President


    public void testCascadeDeleteOneToOne() {
      PersistenceManager pm = pmf.getPersistenceManager();
     
         // A president
      String pName = "Boss";
      President pres = new President(pName);
     

      // A group
      String gName = "SpeedoCascade";
      Group grp = new Group(gName, pres);
      pres.setGroup(grp);
     
      // We make the group persistant
        pm.makePersistent(grp);
       
        // Get the ids
         Object gId = pm.getObjectId(grp);
        Object pId = pm.getObjectId(grp.getPresident());

        pm.close();

        grp = null;
        pres = null;
       
        // Check the creation of the group and its president
        pm = pmf.getPersistenceManager();
        grp = (Group) pm.getObjectById(gId, true);
        pres = (President) pm.getObjectById(pId, true);
    Assert.assertNotNull("null instance returned for group", grp);
    Assert.assertEquals("Bad group name", gName, grp.getName());
    Assert.assertNotNull("null instance returned for president", pres);
    Assert.assertEquals("Bad president name", pName, pres.getName());
   
    /* Delete the group :
     * this should delete the president.
     */
    pm.currentTransaction().begin();
 
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.ref.President

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.