Re: Dates inserted into Oracle do not have Minutes / Seconds?

From: Mike Kienenberger (mkienen..mail.com)
Date: Tue Nov 29 2005 - 11:10:29 EST

  • Next message: Andrus Adamchik: "Re: Dates inserted into Oracle do not have Minutes / Seconds?"

    As I pointed out earlier, the problem is that it depends on what
    version of Oracle you're using :)

    I think the switchover was between 8 and 9, so supporting Oracle 9 and
    10 by default is probably a better choice these days. I don't have a
    problem with whatever defaults we go with because they're just
    defaults and can be changed.

    On 11/29/05, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Ok, I got it. I guess I haven't followed the thread from the
    > beginning. The problem with reverse engineering is that Oracle JDBC
    > driver does return the type as Types.DATE and there is no other hint
    > for Cayenne to make the right decision.
    >
    > Mike and others, how do you feel about changing OracleAdapter to
    > always treat Oracle DATE as JDBC TIMESTAMP? Logically it makes sense,
    > as it seems like Oracle does not have a data type that can store date
    > but can't store time.
    >
    > Andrus
    >
    >
    > On Nov 29, 2005, at 12:49 AM, Ingo Feulner wrote:
    >
    > > Well, the problem is, that at the first creation of a map out of an
    > > existing Oracle database the Oracle DATE field is mapped to the
    > > JDBC DATE type, which means that information (i.e. the time) is
    > > lost (what might not be expected if you're coming from the Oracle
    > > side).
    > >
    > > - Ingo.
    > >
    > > Am 28.11.2005 um 21:42 schrieb Andrus Adamchik:
    > >
    > >> I don't understand why you consider this a bug. If you map it in
    > >> the Modeler using *JDBC* DATE type, expect the time part to be lost.
    > >>
    > >> Meanings of JDBC types are well defined in the spec, independent
    > >> from the underlying database. In other words if Oracle happens to
    > >> call this type a "DATE", it still should be treated as TIMESTAMP
    > >> on the JDBC end. So if you want date+time info be saved, you
    > >> should be using TIMESTAMP in Cayenne mapping (that is based on
    > >> JDBC). And you are free to use any compatible native database type
    > >> with it.
    > >>
    > >> Andrus
    > >>
    > >>
    > >> On Nov 28, 2005, at 10:35 PM, Ingo Feulner wrote:
    > >>
    > >>> Hi,
    > >>>
    > >>> meanwhile I "solved" this issue. Problem is, that the DBAttribute
    > >>> mapping of a DATE Column maps to to DATE in the model, and not to
    > >>> TIMESTAMP.
    > >>> There is a class
    > >>> org.objectstyle.cayenne.access.types.UtilDateType which checks
    > >>> the DBAttribute and converts a java.util.Date then to the
    > >>> appropriate jdbc class.
    > >>> But Oracle allows by default to save date + time in a DATE type,
    > >>> so I would consider this as a bug.
    > >>>
    > >>> What do you think?
    > >>>
    > >>> Regards, Ingo.
    > >>>
    > >>>
    > >>> Am 24.11.2005 um 19:55 schrieb Ingo Feulner:
    > >>>
    > >>>> Hi,
    > >>>>
    > >>>> all our inserted dates into an Oracle (10gR2) database are
    > >>>> missing the
    > >>>> minutes and seconds.
    > >>>> The mapping is DB Type DATE to java.util.Date
    > >>>> Is there a known issue (JDBC driver, NLS_LANG settings, whatever)
    > >>>> (Haven't found one...).
    > >>>>
    > >>>> We're using Cayenne 1.1.3.
    > >>>>
    > >>>> Thanks for any help, Ingo.
    > >>>>
    > >>>>
    > >>>
    > >>>
    > >>
    > >>
    > >
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Nov 29 2005 - 11:10:30 EST