Package org.objectweb.speedo.pobjects.inheritance.prefetch

Examples of org.objectweb.speedo.pobjects.inheritance.prefetch.Employee


  /**
   * Create persistent objects
   */
  public void createInheritedObjects(PersistenceManager pm){
   
    Employee employee1 = new Employee("Herve Landry", 42.4, "Tetra Pack");
    Employee employee2 = new Employee("Vincent Racado", 59, "Tetra Pack");
   
    Department dept = new Department("Production");
   
    Worker worker1 = new Worker("Caroline Bret", 33, "Tetra Pack", true, dept);
    Worker worker2 = new Worker("Evelyne Jain", 54, "Tetra Pack", false, dept);
    Worker worker3 = new Worker("Tim Jorge", 28, "Tetra Pack", false, dept);
   
    Collection days = new ArrayList();
    Day day1 = new Day("monday", 1);
    Day day2 = new Day("tuesday", 2);
    Day day3 = new Day("wednesday", 3);
    Day day4 = new Day("thursday", 4);
    Day day5 = new Day("friday", 5);
    days.add(day1);
    days.add(day2);
    days.add(day3);
    days.add(day4);
    days.add(day5);
   
    worker1.setDays(days);
    worker3.setDays(days);
    Manager manager1 = new Manager("Jean Duverge", 57, "Tetra Pack", "Sales");
    Manager manager2 = new Manager("Eric Mento", 49, "Tetra Pack", "Marketing");
   
    worker1.setMainManager(manager1);
    worker2.setMainManager(manager1);
    worker3.setMainManager(manager2);
   
    Secretary sec1 = new Secretary("Durand Luc", 27, "Tetra Pack", 12);
    Secretary sec2 = new Secretary("Serve Amandine", 34, "Tetra Pack", 10);
   
    Collection employees = new ArrayList();
    employees.add(employee1);
    employees.add(employee2);
    employees.add(worker1);
    employees.add(worker2);
    employees.add(worker3);
    employees.add(manager1);
    employees.add(manager2);
    employees.add(sec1);
    employees.add(sec2);
   
    Iterator it = employees.iterator();
    nbOverLimit = 0;
    while(it.hasNext()){
      Employee e = (Employee) it.next();
      if(e.getAge() > AGE_LIMIT)
        nbOverLimit++;
    }
   
    //make persistent all the persons using a collection
    pm.currentTransaction().begin();
View Full Code Here


    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()){
          Employee e = (Employee) it.next();
          assertNotNull(e);
          logger.log(BasicLevel.DEBUG, e.toString());
        }
        extent.close(it);
  }
View Full Code Here

        assertEquals(nbOverLimit, results.size());
        logger.log(BasicLevel.DEBUG, "Over-" + limit + " ordered:");
    Iterator it = results.iterator();
    double age = 0;
    while(it.hasNext()){
      Employee e = (Employee) it.next();
      assertTrue(age < e.getAge());
      age = e.getAge();
      logger.log(BasicLevel.DEBUG, e.toString());
    }
        query.closeAll();
  }
View Full Code Here

        Collection results = (Collection)query.execute();
        logger.log(BasicLevel.DEBUG, "Over-" + limit + " ordered:");
    Iterator it = results.iterator();
    double age = 0;
    while(it.hasNext()){
      Employee e = (Employee) it.next();
      assertTrue(age < e.getAge());
      age = e.getAge();
      logger.log(BasicLevel.DEBUG, e.toString());
    }
        query.closeAll();
  }
View Full Code Here

        Collection results = (Collection)query.execute();
        logger.log(BasicLevel.DEBUG, "Over-" + limit + " ordered:");
    Iterator it = results.iterator();
    double age = 0;
    while(it.hasNext()){
      Employee e = (Employee) it.next();
      assertTrue(age < e.getAge());
      age = e.getAge();
      logger.log(BasicLevel.DEBUG, e.toString());
    }
        query.closeAll();
  }
View Full Code Here

        Collection results = (Collection)query.execute();
        logger.log(BasicLevel.DEBUG, "Over-" + limit + " ordered:");
    Iterator it = results.iterator();
    double age = 0;
    while(it.hasNext()){
      Employee e = (Employee) it.next();
      assertTrue(age < e.getAge());
      age = e.getAge();
      logger.log(BasicLevel.DEBUG, e.toString());
    }
        query.closeAll();
  }
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.pobjects.inheritance.prefetch.Employee

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.