コード例 #1
0
 public ReadQuery getQueryForTest() {
   ReportQuery testQuery = new ReportQuery();
   testQuery.setReferenceClass(Employee.class);
   ExpressionBuilder employees = new ExpressionBuilder();
   Expression exp = employees.get("firstName").like("B%");
   testQuery.setSelectionCriteria(exp);
   testQuery.cacheQueryResults();
   testQuery.addAttribute("firstName");
   return testQuery;
 }
コード例 #2
0
 public void test() {
   ExpressionBuilder eb = new ExpressionBuilder();
   ReportQuery rq = new ReportQuery(Employee.class, eb);
   rq.addAttribute("firstName");
   rq.addAttribute("lastName");
   Expression exp = eb.getFunction("dbms_random.value");
   exp.setSelectIfOrderedBy(false);
   rq.addOrdering(exp.ascending());
   rq.setSelectionCriteria(eb.anyOf("projects").get("teamLeader").isNull());
   results = (Vector) getSession().executeQuery(rq);
 }
コード例 #3
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");
  }
コード例 #4
0
 public ReportQuery buildReportQuery() {
   ReportQuery reportQuery = new ReportQuery();
   reportQuery.dontRetrievePrimaryKeys();
   reportQuery.returnSingleAttribute();
   return reportQuery;
 }