Package org.objectweb.speedo.tutorial.pobjects.additional.queries

Examples of org.objectweb.speedo.tutorial.pobjects.additional.queries.Person


   * Create persistent objects
   */
  public static void createObjects(PersistenceManager pm){
   
    //create 6 persons
    Person person1 = new Person("Grange Jean-Luc", 54, new ContactDetails("jeanluc.grange@wanadoo.fr", "1234567890"));
    Person person2 = new Person("Bordes Raymond", 75, new ContactDetails("raymond.bordes@wanadoo.fr", "1234567890"));
    Person person3 = new Person("Labbe Loic", 16, new ContactDetails("loic.labbe@wanadoo.fr", "1234567890"));
    Person person4 = new Person("Lambert Celine", 19, new ContactDetails("celine.lambert@wanadoo.fr", "0987654321"));
    Person person5 = new Person("Couture Zelie", 23, new ContactDetails("zelie.couture@wanadoo.fr", "0987654321"));
    Person person6 = new Person("Landreau Vincent", 2, new ContactDetails("vincent.landreau@wanadoo.fr", "0987654321"));
   
    person1.addChild(person4);
    person1.addChild(person5);
   
    person5.addChild(person6);
View Full Code Here


  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

    Query query = pm.newQuery(Person.class, "age < 20");
    Collection results = (Collection)query.execute();
    System.out.println( "Young persons (<20 years old) :");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
    query.closeAll();
    System.out.println();
  }
View Full Code Here

        query.setOrdering("age ascending");
        Collection results = (Collection)query.execute();
        System.out.println( "Over-24 ordered:");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
        query.closeAll();
        System.out.println();
  }
View Full Code Here

    String sName = "Labbe Loic";
    Collection results = (Collection)query.execute(sName);
    System.out.println( sName + " has been retrieved:");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
    query.closeAll();
    System.out.println();
  }
View Full Code Here

    query.setFilter("(name == myName) || (age > 45)");
    Collection results = (Collection)query.execute("Labbe Loic");
    System.out.println( "Result of (name=Labbe Loic || age > 45):");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
    query.closeAll();
    System.out.println();
  }
View Full Code Here

    query.setFilter("contactDetails.phone == phoneNumber");
    Collection results = (Collection)query.execute("1234567890");
    System.out.println( "Result of (contatcDetails.phone == 1234567890):");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
    query.closeAll();
    System.out.println();
  }
View Full Code Here

    query.setFilter("children.contains(child) & child.age < 5");
    Collection results = (Collection)query.execute();
    System.out.println( "Person(s) having children under-5:");
    Iterator it = results.iterator();
    while(it.hasNext()){
      Person p = (Person) it.next();
      System.out.println( p.toString());
    }
    query.closeAll();
    System.out.println();
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.tutorial.pobjects.additional.queries.Person

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.