Thank's Cris,
but i have verified that the data returned by stored procedure have time value.
I have debugged the cayenne source code, and the problem is in this peace of code.
===================================
public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
Object val = null;
switch (type) {
case Types.TIMESTAMP :
val = rs.getTimestamp(index);
break;
case Types.DATE :
val = rs.getDate(index);
break;
case Types.TIME :
val = rs.getTime(index);
break;
default :
val = rs.getObject(index);
break;
}
...
...
===================================
The type passed to this function is retrived by this call:
===================================
ResultSetMetaData md = resulSet.getMetaData();
...
int sqlType = md.getColumnType(pos);
===================================
the type returned is 91 (java.sql.Date)
When cayenne call rs.getDate(index), the type returned by ResultSet is java.sql.Date, with no time information.
I think that the Oracle JDBC Drivers works not well.
The SQL standard Date type have only date value and not the time. In this case the drivers think that this is a standard Date type, but it isn't... it have also the time (java.sql.Timestamp).
So... this is not a Cayenne bug :-)
I have implemented a workaround... i use a String type instead a Date. It's not a good solution, but... my time for this project is over :-)
Thank's
Davide
-----Original Message-----
From: Cris Daniluk [mailto:cris.danilu..mail.com]
Sent: martedģ 28 febbraio 2006 19.55
To: cayenne-use..bjectstyle.org
Subject: Re: java.util.Date & StoredProcedure
j.u.Date includes the time part, so you shouldn't be having trouble. I
can confirm that you can return the time part from an oracle stored
proc, at least in my environment.
Are you sure your stored proc / cursor isn't truncating the date via
implicit casting, etc? Also, in addition to the ObjEntity, there is
also the actual stored procedure entry in the modeler. Make sure you
are specifying the appropriate JDBC type there.
Cris
On 2/28/06, Pirola Davide <davide.pirol..tin.it> wrote:
> Hi Andrus,
> i have a problem with a Date returned form a Oracle cursor in a Stored Procedure.
> I correctly access to data in the cursor, but when i get the value of a Date field, this value haven't the hour/minute/second... only day/month/year.
> I have modified the obj-entity (datamap.xml) in order to map my date field to a java.sql.Timestamp, but cayenne still return me a java.util.Date.
> You can confirm me that also with Stored procedure the type written in the obj-idenity is the one that is returned... or there is a different policy in this case?
>
> Thank's
> Davide
>
This archive was generated by hypermail 2.0.0 : Wed Mar 01 2006 - 05:16:54 EST