db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphael.X.Mankin%GSK...@gsk.com
Subject RE: DATE and TIMESTAMP in Oracle with Torque 3.1
Date Wed, 16 Jun 2004 11:13:54 GMT
My second problem is also a bit of a nuisance. i.e. that the value returned
by Torque is a java.sql.Timestamp (or java.sql.Date) whereas the data
fields are declared as java.util.Date. This causes things to go wrong later
because neither of these returned types is really a semantic sub-type of
java.util.Date and neither is a bean, so  I cannot use them without extra
work in my code. In particular, java.beans.XMLEncoder cannot handle
java.sql.*, but it has special provision for handling java.util.Date.





|---------+---------------------------->
|         |           "Saravana Kannan"|
|         |           <skkann0@engr.uky|
|         |           .edu>            |
|         |                            |
|         |                            |
|         |           15-Jun-2004 16:59|
|         |           Please respond to|
|         |           "Apache Torque   |
|         |           Users List"      |
|         |           <torque-user@db.a|
|         |           pache.org>       |
|         |                            |
|---------+---------------------------->
  >-------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                  |
  |                                                                                      
                                  |
  |                                                                                      
                                  |
  |       To:      "Apache Torque Users List" <torque-user@db.apache.org>          
                                        |
  |                                                                                      
                                  |
  |       cc:                                                                            
                                  |
  |       Subject: RE: DATE and TIMESTAMP in Oracle with Torque 3.1                      
                                  |
  >-------------------------------------------------------------------------------------------------------------------------|



Hi Tony,

  Which of the two problems that Raphael mentioned does your patch solve?
He
said that the DDL generated for both Date and TimeStamp is the same. So
shouldn't that part of Torque be fixed before one can create a table with
TimeStamp in it? Which means - no offense to you - that your patch is
pretty
ineffective because there is nothing it can do about this and there is no
TimeStamp field in the table for your patch to work on, right? I'm a bit
confused about what exactly the problems are for Raphael.

  Conclusion - If your patch solves one or both of this problem, I would
like to
have the source so that I can merge it with my source and give a patched
Village
to the community that has fixes for all Oracle driver induced bugs (Blobs,
Clobs, Timestamps, etc). Please mail me the source if it's fine with you
and if
you think you should ask Bob before passing it on to me - please do so.
Thanks.

-Sarav
(Saravana K Kannan)

Quoting "Foster, Tony" <Tony.Foster@DRKW.com>:

> Yep, that's what it's all about.  But I can't claim to have made the fix
-
> it was the result of a long day's search and some help from Bob over at
> Reuters...
>
> -----Original Message-----
> From: Saravana Kannan [mailto:skkann0@engr.uky.edu]
> Sent: 15 June 2004 4:24 pm
> To: Apache Torque Users List
> Subject: RE: DATE and TIMESTAMP in Oracle with Torque 3.1
>
>
> Hi Tony,
>
> Have you already done the fix? Is it simply a matter of creating a new
> java.sql. Timestamp (with the correct values stored in it) and returning
it
> instead of the
> java.sql.Date? I have a patch for village to take care of the Oracle-BLOB

> problem and you have one for Oracle-Timestamp. I would like to combine
both
> and
> have one single patch. Do you mind sending me the source or diff?
>
> -Sarav
>
> Quoting "Foster, Tony" <Tony.Foster@DRKW.com>:
>
> > This is a problem with the Oracle JDBC driver.  In their wisdom,
> > Oracle decided that the 9i driver would interpret their database DATE
> > type as java.sql.Date, and thus truncate the time-to-the-second
> > portion that it stores.  This, despite the 8i driver treating it as
> > java.sql.Timestamp.
> >
> > What you need to do is patch the Village software to override this
> > bizarre not-a-bug-according-to-Oracle behaviour.  I will send the jar
> > to you directly.
> >
> > Regards
> >
> > TT.
> >
> > -----Original Message-----
> > From: raphael.x.mankin@gsk.com [mailto:raphael.x.mankin@gsk.com] On
> > Behalf Of Raphael.X.Mankin%GSK%SB@gsk.com
> > Sent: 15 June 2004 2:46 pm
> > To: torque-user@db.apache.org
> > Subject: DATE and TIMESTAMP in Oracle with Torque 3.1
> >
> >
> >
> >
> > I am using Torque 3.1 with an Oracle DB. I am trying to create tables
> > that have date/time fields. I find that it makes absolutely no
> > difference whether in the xml I declare the columns as DATE or
> > TIMESTAMP; the DDL and code generated are exactly the same. The effect
> > of this is that the time component of the timesamp is removed before
> > the data is written to the DB. For both DATE and TIMESTAMP fields the
> > generated columns have SQL type DATE and java type java.util.Date.
> >
> > There is a secondary problem. When I retrieve a row from the DB the
> > constructed date object is of type java.sql.Date instead of
> > java.util.Date. The causes an InstantiationException when the returned
> > object is subsequently passed to java.beans.XMLEncoder because the
> > actual value does not match the declared type. The documentation for
> > java.sql.Date in fact warns you that it should NOT be taken as a
> > sub-type of java.util.Date.
> >
> >
> > So, it looks as if we need two fixes:
> > 1. To get full timestamps stored in the DB for Oracle (AFAIK the
> > implementation is correct for mySQL) 2. To ensure that the actual
> > value of a retrieved date or date/time matches its declared type.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >
> >
>
----------------------------------------------------------------------------

> ----
> > The information contained herein is confidential and is intended
> > solely for the addressee. Access by any other party is unauthorised
> > without the express written permission of the sender. If you are not
> > the intended recipient, please
> > contact the sender either via the company switchboard on +44 (0)20 7623
> 8000,
> > or
> > via e-mail return. If you have received this e-mail in error or wish to
> read
> > our
> > e-mail disclaimer statement and monitoring policy, please refer to
> > http://www.drkw.com/disc/email/ or contact the sender. 3166
> >
>
----------------------------------------------------------------------------

> ----
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> >
>
>
> --
> There are 10 kinds of people in the world,
> those who know binary and those who don't.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
--------------------------------------------------------------------------------

> The information contained herein is confidential and is intended solely
for
> the
> addressee. Access by any other party is unauthorised without the express
> written permission of the sender. If you are not the intended recipient,
> please
> contact the sender either via the company switchboard on +44 (0)20 7623
8000,
> or
> via e-mail return. If you have received this e-mail in error or wish to
read
> our
> e-mail disclaimer statement and monitoring policy, please refer to
> http://www.drkw.com/disc/email/ or contact the sender. 3167
>
--------------------------------------------------------------------------------

>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
>


--
There are 10 kinds of people in the world,
those who know binary and those who don't.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org









---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message