Re: help - mysql date search

From: Frank (farocc..otmail.com)
Date: Wed Mar 07 2007 - 14:38:06 EST

  • Next message: Frank: "Sort fails on setPageSize"

    I got this working using the following:

    c.setTime(requestDate);
    c2.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH),
    c.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
    c3.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH),
    c.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
    SelectQuery query = new SelectQuery(Bedlog.class);
    Expression qualifier =
    ExpressionFactory.betweenExp(Bedlog.ADMIT_REQUEST_DATE_PROPERTY,
    c2.getTime(),c3.getTime());
    query.andQualifier(qualifier);

    Is this the best way, or is there a more consise method?

    Regards,
    Frank
    ----- Original Message -----
    From: "Frank" <farocc..otmail.com>
    To: <use..ayenne.apache.org>
    Sent: Wednesday, March 07, 2007 11:06 AM
    Subject: help - mysql date search

    Hello,

    I cannot get cayenne to l imit records based on a mysql date field.
    I tried two variations below.
    The date is stored as datetime and has a date & time value.
    I only need to limit records based on date.
    What am I doing wrong?
    //Expression qualifier =
    ExpressionFactory.matchDbExp(Bedlog.ADMIT_REQUEST_DATE_PROPERTY,
    requestDate);

    Expression qualifier =
    ExpressionFactory.betweenExp(Bedlog.ADMIT_REQUEST_DATE_PROPERTY,
    requestDate,requestDate);

    query.andQualifier(qualifier);

    Regards,

    Frank



    This archive was generated by hypermail 2.0.0 : Wed Mar 07 2007 - 14:39:36 EST