FAQ
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

Search Discussions

  • Frank at Mar 7, 2007 at 7:38 pm
    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" <farocco@hotmail.com>
    To: <user@cayenne.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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMar 7, '07 at 4:07p
activeMar 7, '07 at 7:38p
posts2
users1
websitecayenne.apache.org

1 user in discussion

Frank: 2 posts

People

Translate

site design / logo © 2022 Grokbase