Package javax.jdo

Examples of javax.jdo.PersistenceManager.refresh()


      p.setAge(2000);
      p.setAddress(a);
      Person pc = (Person) p.getChildren().iterator().next();
      pc.setAge(3000);
      pc.setAddress(a);
      pm.refresh(parent);
      pm.currentTransaction().commit();

      Person ch = (Person) parent.getChildren().iterator().next();
      assertEquals(40, ch.getAge());
      assertEquals(address.getCity(), ch.getAddress().getCity());
View Full Code Here


      pChild.setAge(3000);
      pChild.setAddress(a);
      Person pGrandChild = (Person) pChild.getChildren().iterator().next();
      pGrandChild.setAge(4000);
      pGrandChild.setAddress(a);
      pm.refresh(grandParent);
      pm.currentTransaction().commit();
     
      Person cParent = (Person) grandParent.getChildren().iterator().next();
      assertEquals(70, cParent.getAge());
      assertEquals(address.getCity(), cParent.getAddress().getCity());
View Full Code Here

    try{
      pm.currentTransaction().begin();
      String nodeName = (String) n1.getEdges().keySet().iterator().next();
      EdgeWeight ew = (EdgeWeight) n1.getEdges().get(nodeName);
      ew.setWeight(3000);
      pm.refresh(n1);
      pm.currentTransaction().commit();
      assertEquals(2, ew.getWeight());
    } catch(Exception e) {
      if (pm.currentTransaction().isActive())
        pm.currentTransaction().rollback();
View Full Code Here

    try {
      pm.currentTransaction().begin();
      String nodeName = (String) n1.getEdges().keySet().iterator().next();
      EdgeWeight ew = (EdgeWeight) n1.getEdges().get(nodeName);
      ew.setWeight(3000);
      pm.refresh(n1);
      pm.currentTransaction().commit();
      assertEquals(3000, ew.getWeight());
    } catch(Exception e) {
      if (pm.currentTransaction().isActive())
        pm.currentTransaction().rollback();
View Full Code Here

      pm.currentTransaction().begin();
      //update the age and the address
      parent.setAge(99);
      Address newAddress = new Address("rue Ampere", "Rennes", new Country("bz", "Bretagne"));
      parent.setAddress(newAddress);
      pm.refresh(parent)
      pm.currentTransaction().commit();
      assertEquals(32, parent.getAge());
      assertEquals(address.getCity(), parent.getAddress().getCity());
      assertEquals(address.getStreet(), parent.getAddress().getStreet());
    } catch(Exception e) {
View Full Code Here

      //update the first child age and address
      Person p = (Person) parent.getChildren().iterator().next();
      p.setAge(2000);
      Address newAddress = new Address("Rue Refresh", "Moon", new Country("m", "mars"));
      p.setAddress(newAddress);
      pm.refresh(parent);
   
      int totalAgeRefreshed = 0;
      Iterator it = parent.getChildren().iterator();
      Person ch = null;
      while (it.hasNext()) {
View Full Code Here

      //  update the first child age and address
      Person p = (Person) parent.getChildren().iterator().next();
      p.setAge(2000);
      Address newAddress = new Address("Rue Far", "Moon", new Country("n", "neptune"));
      p.setAddress(newAddress);
      pm.refresh(parent);
   
      pm.currentTransaction().commit();
      Person ch = (Person) parent.getChildren().iterator().next();
      int expectedAge  = 0;
      if (ch.getName().equals(child1.getName())) {
View Full Code Here

      p.setAge(2000);
      p.setAddress(a);
      Person pc = (Person) p.getChildren().iterator().next();
      pc.setAge(3000);
      pc.setAddress(a);
      pm.refresh(parent);
      logger.log(BasicLevel.DEBUG, "Warning: the child of child will not be refreshed.");
      pm.currentTransaction().commit();
     
      Person ch = (Person) parent.getChildren().iterator().next();
      int expectedAge = 0;
View Full Code Here

    pm.currentTransaction().begin();
    pm.makePersistent(ba);
        pm.currentTransaction().commit();
       
    pm.currentTransaction().begin();
    pm.refresh(ba);
    int f2 = ba.readF2();
    assertTrue("bad F2 value:" + f2, f2 < 4);
        pm.currentTransaction().commit();
       
    pm.currentTransaction().begin();
View Full Code Here

    pm.makePersistent(ba);
        pm.currentTransaction().commit();
       
    pm.currentTransaction().begin();
    ba.writeF2(4);
    pm.refresh(ba);
    int f2 = ba.readF2();
    assertTrue("bad F2 value:" + f2, f2 < 4);
        pm.currentTransaction().commit();
       
    pm.currentTransaction().begin();
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.