Package javax.jdo

Examples of javax.jdo.Extent


    q.closeAll();
    pm.close();

    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    Extent e = pm.getExtent(Concurrent.class, false);
    it = e.iterator();
    while(it.hasNext()) {
      pm.deletePersistent(it.next());
    }
    pm.currentTransaction().commit();
    pm.close();
View Full Code Here


    a = null;
    cat = null;
    mar = null;
    pm.evictAll();

    Extent extent = pm.getExtent(Catalogue.class, true);
    Iterator it = extent.iterator();
    while(it.hasNext()) {
      cat = (Catalogue) it.next();
      logger.log(BasicLevel.DEBUG, "Catalogue " + cat.getId());
      Collection arts = cat.getArticles();
      Iterator articles = arts.iterator();
      while(articles.hasNext()) {
        a = (Article) articles.next();
        logger.log(BasicLevel.DEBUG, "\tArticle " + a.getId());
        Collection mars = a.getMarches();
        Iterator marches = mars.iterator();
        while (marches.hasNext()) {
          mar = (Marche) marches.next();
          logger.log(BasicLevel.DEBUG, "\t\tMarche " + mar.getId());
          Collection m2as = mar.getArticles();
          assertTrue("The article '" + a.getId()
            + "' is not in the collection marche(" + mar.getId()
            + ").articles", m2as.contains(a));
        }
      }
    }
    extent.closeAll();

    a = null;
    cat = null;
    mar = null;
    pm.currentTransaction().begin();
    extent = pm.getExtent(Article.class, true);
    it = extent.iterator();
    while (it.hasNext()) {
      a = (Article) it.next();
      cat = a.getCatalogue();
      if (cat != null) {
        pm.deletePersistent(cat);
View Full Code Here

    pm.getObjectIdClass(Personne.class);
    pm.getObjectIdClass(Team.class);
    pm.getObjectIdClass(Vehicle.class);
      pm.getObjectIdClass(Checkpoint.class);
       
      Extent extent = pm.getExtent(Team.class, false);
      Iterator it = extent.iterator();
      while(it.hasNext()) {
        Object a =  it.next();
          System.out.print(a.toString());
      }
      extent.closeAll();
      pm.close();
  }
View Full Code Here

      } else if (cl == A3.class) {
        nbExpected = nbOfA3;
      }
     
      pm.currentTransaction().begin();
      Extent extent = pm.getExtent(cl, true);
      Iterator it = extent.iterator();
      String className = cl.getName().substring(cl.getName().lastIndexOf("."));
      logger.log(BasicLevel.DEBUG, "All " + cl.getName() + " instances:");
      while(it.hasNext()){
        A1 a = (A1) it.next();
        assertNotNull("The A should not be null", a);
        nb++;
      }
      extent.close(it);
      pm.currentTransaction().commit();
      assertEquals("The size of elements retrieved is not right.", nbExpected, nb);
    } catch (Exception e) {
      fail(e.getMessage());
    } finally {
View Full Code Here

        pm.currentTransaction().commit();
  }
 
  //iterate over all the persons
  public static void iterateExtent(PersistenceManager pm){
    Extent extent = pm.getExtent(Person.class, true);
        Iterator it = extent.iterator();
        System.out.println( "All " + Person.class.getName() + " instances:");
        while(it.hasNext()){
          Person p = (Person) it.next();
          System.out.println( p.toString());
        }
        extent.close(it);
        System.out.println();
  }
View Full Code Here

    private void iterateExtent(Class cl){
        logger.log(BasicLevel.INFO, "Search all form (including sub classes):");
        PersistenceManager pm = pmf.getPersistenceManager();
        try {
            pm.currentTransaction().begin();
            Extent extent = pm.getExtent(cl, true);
            Iterator it = extent.iterator();
            while(it.hasNext()){
                Form f = (Form) it.next();
                logger.log(BasicLevel.INFO, "\t- form.id=" + f.getId());
            }
            extent.close(it);
            pm.currentTransaction().commit();
        } catch (Exception e) {
            logger.log(BasicLevel.ERROR, e);
        } finally {
            if (pm.currentTransaction().isActive())
View Full Code Here

        pm.currentTransaction().commit();
  }
 
  //iterate over all the instances of a class cl
  public static void iterateExtent(PersistenceManager pm, Class cl){
    Extent extent = pm.getExtent(cl, true);
        Iterator it = extent.iterator();
        System.out.println( "All " + cl.getName() + " instances:");
        while(it.hasNext()){
          Employee e = (Employee) it.next();
          System.out.println( e.toString());
        }
        extent.close(it);
  }
View Full Code Here

      }
      if (debug) {
        logger.log(BasicLevel.DEBUG, "Thread " + threadId
                + " min = " + min + " / max = " + max);
      }
      Extent liui = pm.getExtent(LinkedIntUserId.class, false);
      String filter = "((name>min) && (name<max))";
      Query query = pm.newQuery(liui, filter);
      query.declareParameters("Integer min, Integer max");
      Collection cLinkedUsers = (Collection) query.execute(new Integer(min), new Integer(max));
      Iterator iterator = cLinkedUsers.iterator();
View Full Code Here

  public void test2BigExtent() {
    logger.log(BasicLevel.WARN, "Using the extent ...");
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.evictAll();
    long t = Calendar.getInstance().getTimeInMillis();
    Extent e = pm.getExtent(BasicA.class, false);
    Iterator it = e.iterator();
    int i= 0;
    while(it.hasNext()) {
      BasicA ba = (BasicA) it.next();
      logger.log(BasicLevel.DEBUG, ba.readF1());
    }
    e.closeAll();
    pm.close();
    t = Calendar.getInstance().getTimeInMillis() - t;
    logger.log(BasicLevel.WARN, "Time: " + t + "ms");
  }
View Full Code Here

  public void testRemoveObject(int NBOBJ) {
    logger.log(BasicLevel.WARN, "Removing " + NBOBJ + " objects ...");
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    Extent e = pm.getExtent(BasicA.class, false);
    Iterator it = e.iterator();
    int i= 0;
    while(it.hasNext()) {
      assertTrue("More object than expected, expected="
        + NBOBJ + ", found " + (i + 1), i < NBOBJ);
      BasicA ba = (BasicA) it.next();
      pm.deletePersistent(ba);
      logger.log(BasicLevel.DEBUG, ba.readF1());
      i++;
    }
    e.closeAll();
    pm.currentTransaction().commit();
    pm.close();
  }
View Full Code Here

TOP

Related Classes of javax.jdo.Extent

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.