コード例 #1
0
 public void test() {
   ReadAllQuery q = new ReadAllQuery();
   q.setBatchFetchType(batchType);
   q.setReferenceClass(Shipment.class);
   q.addBatchReadAttribute("employee");
   q.setSelectionCriteria(
       q.getExpressionBuilder()
           .get("employee")
           .get("address")
           .equal(q.getExpressionBuilder().getParameter("ADDRESS")));
   q.addArgument("ADDRESS");
   Vector r = new Vector();
   r.addElement("885 Meadowlands Dr.");
   UnitOfWork uow = getSession().acquireUnitOfWork();
   v = (java.util.Vector) uow.executeQuery(q, r);
 }
コード例 #2
0
  protected void test() {
    query = new ReadAllQuery();
    query.setReferenceClass(referenceClass);

    ReportQuery hierarchyQuery = new ReportQuery();
    hierarchyQuery.setReferenceClass(referenceClass);
    // The #employeeId is what would cause the error
    hierarchyQuery.setCall(new SQLCall("SELECT EMP_ID FROM EMPLOYEE WHERE MANAGER_ID=#employeeId"));

    query.setSelectionCriteria(query.getExpressionBuilder().get("id").in(hierarchyQuery));
    // want the argument at the top level query
    query.addArgument("employeeId");
  }