Package org.objectweb.speedo.j2eedo.database

Examples of org.objectweb.speedo.j2eedo.database.Employee


        try {
        Collection col = (Collection) query.execute(p);
        Iterator iter = col.iterator();
        if (!iter.hasNext())
          throw new RuntimeException("Query on employee does not return any row");
        Employee e = null;
        while (iter.hasNext()) {
          e = (Employee) iter.next();
          outStr.append("\n\tEmployee name:");
          outStr.append(e.getFirstname());
          outStr.append(" ");
          outStr.append(e.getLastname());
            }
        } finally {
            query.closeAll();
    }
  }
View Full Code Here


    try {
            Collection col = (Collection) query.executeWithArray(param);
        Iterator iter = col.iterator();
        if (!iter.hasNext())
          throw new RuntimeException("Query on employee does not return any row");
        Employee e = (Employee) iter.next();
        outStr.append("\n\tEmployee name (").append(e.getEmpid());
        outStr.append("): ").append(e.getFirstname()).append(" ");
        outStr.append(e.getLastname());
        if (false && e.getEmpid() != idMax) {
          throw new RuntimeException("Query on employee returns an other first row than expecting");
        }
        while (iter.hasNext()) {
          e = (Employee) iter.next();
          outStr.append("\n\tEmployee name (").append(e.getEmpid());
          outStr.append("): ").append(e.getFirstname()).append(" ");
          outStr.append(e.getLastname());
        }
        if (false && e.getEmpid() != idMin)
          throw new RuntimeException("Query on employee returns an other last row than expecting");
        } finally {
            query.closeAll();
        }
    }
View Full Code Here

            query.closeAll();
        }
    }

  private void queryEmployeeByManager(StringBuffer outStr, PersistenceManager pm) {
    Employee e = (Employee) pm.getObjectById(
          pm.newObjectIdInstance( Employee.class,
              Long.toString(DatabaseImpl.getEmployeeIdFromPool())),
              false);
    Employee boss = e.getManager();
    outStr.append("\nLook for employees having the same manager : ");
    if (null != boss) {
      outStr.append(boss.getLastname());
        } else {
      outStr.append("NULL");
        }
    logger.log(BasicLevel.DEBUG, "Query employee having the same manager :"
        +((null==boss)? "null" : boss.getLastname()));
    Query query = pm.newQuery(Employee.class);
    query.declareParameters("org.objectweb.speedo.j2eedo.database.Employee e");
    query.setFilter("(manager==e)");
    try {
            Collection col = (Collection) query.execute(boss);
View Full Code Here

TOP

Related Classes of org.objectweb.speedo.j2eedo.database.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.