Re: Handling of DATE and TIME values

From: Mike Kienenberger (mkienen..mail.com)
Date: Wed Dec 07 2005 - 09:18:45 EST

  • Next message: Dave Merrin: "Is registerNewObject required?"

    I think if you use java.sql.Date and java.sql.Time, everything will be
    converted correctly for you.

    "Calendar.setTime(Date)" and "Date Calendar.getTime()" is probably
    what you're missing :)

    On 12/7/05, Todd O'Bryan <toddobrya..ac.com> wrote:
    > If I use a Date object to match a DATE or TIME field in a database,
    > does Cayenne automatically do the right thing or do I have to fiddle
    > with the values myself? (By that, I mean do I need to set the time to
    > 0:00:00 before I try to match a Date to a DATE field, or set the date
    > to Jan 1 1970 before I try to match a TIME field?)
    >
    > If the latter, how do people deal with this? All the methods to
    > manipulate parts of a Date have been deprecated. You can fiddle with
    > things correctly in GregorianCalendar and convert that to a Date,
    > but, as far as I can tell, there's no easy parseDate(String) method
    > that returns a GregorianCalendar and there's no way to convert the
    > other way, i.e., from Date to GregorianCalendar.
    >
    > Surely I'm missing something, right?
    >
    > TIA,
    > Todd
    >



    This archive was generated by hypermail 2.0.0 : Wed Dec 07 2005 - 09:18:47 EST