getting obejcts, search criteria is date

From: martin ruff (mruf..imeon.ch)
Date: Thu Nov 28 2002 - 08:40:23 EST

  • Next message: martin ruff: "Re: Survey: usage scenarios/performance/mile stone wishlist"

    Hi,
    it's me again, after I've read all the documentation and the javadocs I
    come along with my question:
    I've got a table:
    CREATE TABLE reportingdates(
    id serial NOT NULL PRIMARY KEY,
    fk_employeeid int4 NOT NULL,
    reportingdate date NOT NULL);

    now I want to get objects for a certain employee in a time frame
    (begindate<= <=enddate)
    what I did:
                    Expression employeeid = ExpressionFactory.binaryPathExp(
                                              Expression.EQUAL_TO,
                                              "fkEmployeeid",
                                              employeeID);
                     Expression begindate = ExpressionFactory.binaryPathExp(
                                              Expression.GREATER_THAN_EQUAL_TO,
                                              "reportingdate",
                                              beginDate);
                     Expression enddate = ExpressionFactory.binaryPathExp(
                                              Expression.LESS_THAN_EQUAL_TO,
                                              "reportingdate",
                                              endDate);

                    employeeid.andExp(begindate);
                    employeeid.andExp(enddate);
                    int operandcount = employeeid.getOperandCount();
                    SelectQuery query = new SelectQuery("Reportingdates", employeeid);
                    query.addOrdering("reportingdate", true);
                    return theDataContext.performQuery(query);

    beginDate and endDate are of type java.util.date
    what happens is: the first filter (employeeID) works but the date
    filters do not work, wich means I get ALL entries for employeeID instead
    of ALL entries for employeeID BETWEEN bebinDate and andDate
    by the way where can I get more information about building expressions?
    thanks
    martin



    This archive was generated by hypermail 2.0.0 : Thu Nov 28 2002 - 08:40:36 EST