You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Jan-Martin Roth <jm...@mtg.de> on 2003/12/22 11:41:22 UTC
Re: Oracle and Dates... better workingdogs!
Hi all,
we've had the same problem.
The cause seems to be the 9i JDBC-dirver that has a problem with the
time-component of DATE-values. (Oracle 8i JDBC driver does fine.)
The problem is, that oracle returns DataType 91 (DATE) instead of 93
(Timestamp). Therfore in the workindogs-classes the time of the day is
ignored afterwards.
We have put a work-around in the com.workingdogs classes in torque-utils.jar
I will mail a library workingdogs.jar to your mail-adress.
Try that (and remove the corresponding classes from torque-utils.jar!).
Merry XMas to all!
Jan-Martin Roth
Dipl.Math. Jan-Martin Roth
JMRoth@mtg.de
media transfer AG
Dolivostr. 11
D-64293 Darmstadt
Tel. +49 6151 8193 20
Fax +49 6151 8193 41
Web: http://www.mtg.de
Pierre Henry schrieb:
> Hi all ,
>
> There seems to be a problem when inserting into columns of type date
> into Oracle (9i).
>
> I have an entity Projection with a field of type "date" in schema.xml.
>
> Here is what I do :
> Date nowDate = new Date();
> nowDate.setTime(System.currentTimeMillis());
> Calendar now = new GregorianCalendar();
> now.setTime(nowDate);
> now.set(Calendar.HOUR_OF_DAY, hourOfDay);
> now.set(Calendar.MINUTE, minutes);
> now.set(Calendar.SECOND, 0);
> now.set(Calendar.MILLISECOND, 0);
>
> Projection proj = new Projection();
> ...
> proj.setPDate(now.getTime());
> proj.save();
>
>
> But the sql query
> select to_char(p_date,'DD-MM-YYYY HH24:MI:SS') from projection
> shows that only the year-month-day values are stored. The hour-minutes
> are set to zeros.
>
> I found an issue on this in the list archive dating back to 2002 (here
> is the url of the thread :
> http://nagoya.apache.org/eyebrowse/BrowseList?listName=torque-user@db.apache.org&by=thread&from=194695
> )
>
> but there is no answer solving the problem, and it seems that it hasn't
> been fixed since then.
> The change from date to timestamp in schema.xml does not affect the
> actual oracle type which is generated (which remains date).
>
> Does anybody have a fix or workaround to this problem ? I would be very
> gratefull !!
>
> Pierre Henry
>
>
>
>
> ---------------------------------------------------------------------
> 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
Re: Oracle and Dates... better workingdogs!
Posted by Pierre Henry <he...@hta-bi.bfh.ch>.
Hi everybody.
Thank you so much Jan-Martin !
I replaced the village-2.0-dev-20030825.jar library with your modfied
library and now It is working fine, the inserts as well as selects and
comparisons in Criteria.
Happy 2004 to all !
Pierre Henry
Jan-Martin Roth wrote:
> Hi all,
>
> we've had the same problem.
>
> The cause seems to be the 9i JDBC-dirver that has a problem with the
> time-component of DATE-values. (Oracle 8i JDBC driver does fine.)
>
> The problem is, that oracle returns DataType 91 (DATE) instead of 93
> (Timestamp). Therfore in the workindogs-classes the time of the day is
> ignored afterwards.
>
> We have put a work-around in the com.workingdogs classes in
> torque-utils.jar
>
> I will mail a library workingdogs.jar to your mail-adress.
> Try that (and remove the corresponding classes from torque-utils.jar!).
>
> Merry XMas to all!
>
> Jan-Martin Roth
>
> Dipl.Math. Jan-Martin Roth
> JMRoth@mtg.de
>
> media transfer AG
> Dolivostr. 11
> D-64293 Darmstadt
> Tel. +49 6151 8193 20
> Fax +49 6151 8193 41
> Web: http://www.mtg.de
>
> Pierre Henry schrieb:
>
>> Hi all ,
>>
>> There seems to be a problem when inserting into columns of type date
>> into Oracle (9i).
>>
>> I have an entity Projection with a field of type "date" in schema.xml.
>>
>> Here is what I do :
>> Date nowDate = new Date();
>> nowDate.setTime(System.currentTimeMillis());
>> Calendar now = new GregorianCalendar();
>> now.setTime(nowDate);
>> now.set(Calendar.HOUR_OF_DAY, hourOfDay);
>> now.set(Calendar.MINUTE, minutes);
>> now.set(Calendar.SECOND, 0);
>> now.set(Calendar.MILLISECOND, 0);
>>
>> Projection proj = new Projection();
>> ...
>> proj.setPDate(now.getTime());
>> proj.save();
>>
>>
>> But the sql query
>> select to_char(p_date,'DD-MM-YYYY HH24:MI:SS') from projection
>> shows that only the year-month-day values are stored. The
>> hour-minutes are set to zeros.
>>
>> I found an issue on this in the list archive dating back to 2002
>> (here is the url of the thread :
>> http://nagoya.apache.org/eyebrowse/BrowseList?listName=torque-user@db.apache.org&by=thread&from=194695
>> )
>>
>> but there is no answer solving the problem, and it seems that it
>> hasn't been fixed since then.
>> The change from date to timestamp in schema.xml does not affect the
>> actual oracle type which is generated (which remains date).
>>
>> Does anybody have a fix or workaround to this problem ? I would be
>> very gratefull !!
>>
>> Pierre Henry
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org