Re: Need help with date query

From: Daniel Lorimer (thelorime..mail.com)
Date: Wed Jun 29 2005 - 16:55:15 EDT

  • Next message: Mike Kienenberger: "Re: Many to Many Relation"

    Ok,

    I figured that was probably what I would have to do.

    Thanks for your help!

    Daniel Lorimer

    On 6/29/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >
    > "Between" intervals will work for some but not all such queries. E.g.
    > "select all contacts with birthday in March regardless of the year"
    > requires a way to extract month from date before matching. Cayenne
    > expressions will not handle that.
    >
    > So I guess a creating a SQLTemplate in the Modeler is the way to go
    > in such cases.
    >
    > Andrus
    >
    >
    > On Jun 29, 2005, at 4:33 PM, Cris Daniluk wrote:
    >
    > > 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:55:16 EDT