Search code examples
javatoplink

How to add a "myfields >= TRUNC(sysdate)" clause with ExpressionBuilder to a ReportQuery (Toplink)


I've this code

            Expression expRefr = new ExpressionBuilder();
            expRefr = expRefr.and(new ExpressionBuilder().get("refrCd").equal(referenza));
            expRefr = expRefr.and(new ExpressionBuilder().get("enteCd").equal(pEnteCd));
            expRefr = expRefr.and(new ExpressionBuilder().get("dpCdTipo").equal("V"));

            final ReportQuery refrQuery = 
                new ReportQuery(BoEnteRefrPrmz.class, expRefr);

i need to add a dpDtFineVald>= TRUNC(sysdate) clause to the WHERE condition, what should i do? Something like

expRefr = 
   expRefr.and(new ExpressionBuilder().get("dpDtFineVald").greaterThanEqual(//What should i put here?);

Solution

  • I have no idea about toplink or Expression. I just tried this with what I got from Google. Please check.

    String format = "MM/dd/yyyy";
    
    expRefr = expRefr.and(new ExpressionBuilder().get("dpDtFineVald").truncateDate(format).greaterThanEqual(new ExpressionBuilder().currentDate().truncateDate(format));