db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Henry <he...@hta-bi.bfh.ch>
Subject Oracle and Dates...
Date Fri, 19 Dec 2003 14:07:35 GMT
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


Mime
View raw message