Re: Need help with date query

From: Cris Daniluk (cris.danilu..mail.com)
Date: Wed Jun 29 2005 - 16:33:26 EDT

  • Next message: Andrus Adamchik: "Re: Need help with date query"

    Why not just use an Expression and some dates?

    Create a date object for the beginning of 1967 and for the end of 1967, then do:

    context.performQuery(yourQuery, Expression.betweenExp("birthdate",
    beginningOfYear, endOfYear));

    Cris

    On 6/29/05, Daniel Lorimer <thelorime..mail.com> wrote:
    > I'm working with date queries in Java using Cayenne as the ORM and MySQL as
    > the database.
    >
    > What I want to do now is allow the user to select queries based only on the
    > year, month, or day.
    > For instance: all contacts born in 1967, all contacts with a birthday in
    > March, etc.
    >
    > I know this can be done relatively easily in MySQL.
    >
    > My question is, is there an easy way to do this with Cayenne.
    >
    > I assume I have to build a SQLTemplate query. Is this correct?
    >
    > However, before I go building some complex query, I'd like to know if
    > there's a simpler way.
    >
    > Either way, I'd appreciate some suggestions.
    >
    > Thanks so much,
    > Daniel Lorimer
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 29 2005 - 16:33:27 EDT