Package javax.jdo

Examples of javax.jdo.FetchPlan


    children2.add(child21);
    child1.setChildren(children1);
    child2.setChildren(children2);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detailChildren2").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
    try{
      pm.currentTransaction().begin();
      Address a = new Address("Rue Away", "Moon", new Country("pl", "Pluton"));
      Person p = (Person) parent.getChildren().iterator().next();
      p.setAge(2000);
View Full Code Here


    grandChildren2.add(grandChild2);
    child1.setChildren(grandChildren1);
    child2.setChildren(grandChildren2);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detailChildren3").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + grandParent.toString());
    pm.makePersistent(grandParent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try {
      pm.currentTransaction().begin();
      Address a = new Address("Rue From", "Moon", new Country("sl", "Solarus"));
      Person pParent = (Person) grandParent.getChildren().iterator().next();
View Full Code Here

   
    n2.addEdge(n4.getName(), new EdgeWeight(7));
    n2.addEdge(n5.getName(), new EdgeWeight(4));
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("keyValue").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the nodes " + n1.toString() + ", " + n2.toString()
        + ", " + n3.toString() + ", " + n4.toString() + ", " + n5.toString());
    pm.makePersistent(n1);
    pm.makePersistent(n2);
    pm.makePersistent(n3);
    pm.makePersistent(n4);
    pm.makePersistent(n5);
    pm.currentTransaction().commit();
   
    FetchPlan f = pm.getFetchPlan();
    logger.log(BasicLevel.DEBUG, "FG: " + f.getGroups());
   
    try{
      pm.currentTransaction().begin();
      String nodeName = (String) n1.getEdges().keySet().iterator().next();
      EdgeWeight ew = (EdgeWeight) n1.getEdges().get(nodeName);
View Full Code Here

      pm.makePersistent(convention2);
     
      pm.currentTransaction().commit();
   
      //set the fetch group to listeIntervenants
      FetchPlan fp = pm.getFetchPlan();
      fp.clearGroups().addGroup("listeIntervenants");
      //detach the  intervenant
      IntervenantHelper copyOfIntervenant1 = (IntervenantHelper) pm.detachCopy(intervenant1);
      assertNotNull(copyOfIntervenant1);
      assertEquals("Nomep of intervenant1 and its detached copy are not the same.", intervenant1.getNomep(), copyOfIntervenant1.getNomep());
      Collection conv = intervenant1.getConventions();
      Collection copyConv = copyOfIntervenant1.getConventions();
      assertEquals("Size of conventions not the same for intervenant1 and its detached copy.", conv.size(), copyConv.size());
      Iterator itConv = conv.iterator();
      Iterator itCopyConv = copyConv.iterator();
      while (itConv.hasNext() && itCopyConv.hasNext()) {
        ConventionHelper convention = (ConventionHelper) itConv.next();
        ConventionHelper copyConvention = (ConventionHelper) itCopyConv.next();
        assertEquals("cdmem is not the same for the convention and its detached copy", convention.getCdmem(), copyConvention.getCdmem());
        assertEquals("nomep is not the same for the convention and its detached copy", convention.getNomep(), copyConvention.getNomep());
        SpecialiteMercureHelper specialiteMercure = convention.getSpecialiteMercure();
        SpecialiteMercureHelper copySpecialiteMercure = copyConvention.getSpecialiteMercure();
            assertEquals("cdmed not the same for the specialiteMercure and its detached copy", specialiteMercure.getCdmed(), copySpecialiteMercure.getCdmed());
            assertEquals("cdmec not the same for the specialiteMercure and its detached copy", specialiteMercure.getCdmec(), copySpecialiteMercure.getCdmec());
            assertEquals("cdmese not the same for the specialiteMercure and its detached copy", specialiteMercure.getCdmese(), copySpecialiteMercure.getCdmese());
            DomaineHelper domaine = specialiteMercure.getDomaine();
            DomaineHelper copyDomaine = copySpecialiteMercure.getDomaine();
            assertEquals("cdmed not the same for the domaine and its detached copy", domaine.getCdmed(), copyDomaine.getCdmed());
            assertEquals("limed not the same for the domaine and its detached copy", domaine.getLimed(), copyDomaine.getLimed());
            MarqueHelper marque = convention.getMarque();
        MarqueHelper copyMarque = copyConvention.getMarque();
        assertEquals("cdmem is not the same for the marque and its detached copy", marque.getCdmem(), copyMarque.getCdmem());
        assertEquals("limem is not the same for the marque and its detached copy", marque.getLimem(), copyMarque.getLimem());
      }
     
      //query
        Query query = pm.newQuery(ConventionHelper.class);
        StringBuffer filter = new StringBuffer();
        filter.append("(intervenant.nomep == (\"" +
                         intervenant1.getNomep() + "\")) && ");
        filter.append("(cdmem == (\"" + marque1.getCdmem() + "\"))");
          query.setFilter(filter.toString());
          //fetchplan
        fp = pm.getFetchPlan().clearGroups();
        fp.addGroup("listeConventions");
        //execute
        Collection results = (Collection) query.execute();
        //detach all the conventions retrieved
        Collection detachedConv = pm.detachCopyAll(results);
        Iterator itDC = detachedConv.iterator();
View Full Code Here

   
    n2.addEdge(n4.getName(), new EdgeWeight(7));
    n2.addEdge(n5.getName(), new EdgeWeight(4));
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("keyOnly").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the nodes " + n1.toString() + ", " + n2.toString()
        + ", " + n3.toString() + ", " + n4.toString() + ", " + n5.toString());
    pm.makePersistent(n1);
    pm.makePersistent(n2);
    pm.makePersistent(n3);
    pm.makePersistent(n4);
    pm.makePersistent(n5);
    pm.currentTransaction().commit();
   
    FetchPlan f = pm.getFetchPlan();
    logger.log(BasicLevel.DEBUG, "FG: " + f.getGroups());
   
    try {
      pm.currentTransaction().begin();
      String nodeName = (String) n1.getEdges().keySet().iterator().next();
      EdgeWeight ew = (EdgeWeight) n1.getEdges().get(nodeName);
View Full Code Here

    children.add(child1);
    children.add(child2);
    parent.setChildren(children);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detail").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
    try {
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      logger.log(BasicLevel.DEBUG, "Name can be accessed: " + detachedParent.getName());
      logger.log(BasicLevel.DEBUG, "Age can be accessed: " + detachedParent.getAge());
View Full Code Here

    children.add(child1);
    children.add(child2);
    parent.setChildren(children);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detail+children-names").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
   
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
    try {
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      logger.log(BasicLevel.DEBUG, "Name can be accessed: " + detachedParent.getName());
      logger.log(BasicLevel.DEBUG, "Age can be accessed: " + detachedParent.getAge());
View Full Code Here

    children.add(child1);
    children.add(child2);
    parent.setChildren(children);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detail+children-list").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
   
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
    try {
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      logger.log(BasicLevel.DEBUG, "Name can be accessed: " + detachedParent.getName());
      logger.log(BasicLevel.DEBUG, "Age can be accessed: " + detachedParent.getAge());
View Full Code Here

    children2.add(child21);
    child1.setChildren(children1);
    child2.setChildren(children2);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detailChildren").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try {
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      assertEquals(parent.getName(), detachedParent.getName());
View Full Code Here

    children2.add(child21);
    child1.setChildren(children1);
    child2.setChildren(children2);
   
    PersistenceManager pm = pmf.getPersistenceManager();
    FetchPlan fp = pm.getFetchPlan();
    fp.clearGroups();
    fp.addGroup("detailChildren2").removeGroup("default");
    pm.currentTransaction().begin();
    logger.log(BasicLevel.DEBUG, "make persistent the person " + parent.toString());
    pm.makePersistent(parent);
    pm.currentTransaction().commit();
    logger.log(BasicLevel.DEBUG, "FG: " + fp.getGroups());
   
    try{
      pm.currentTransaction().begin();
      Person detachedParent = (Person) pm.detachCopy(parent);
      assertEquals(parent.getName(), detachedParent.getName());
View Full Code Here

TOP

Related Classes of javax.jdo.FetchPlan

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.