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; }
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); }
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"); }
public ReportQuery buildReportQuery() { ReportQuery reportQuery = new ReportQuery(); reportQuery.dontRetrievePrimaryKeys(); reportQuery.returnSingleAttribute(); return reportQuery; }