db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter S. Hamlen" <pham...@mail.com>
Subject Re: timestamp is being truncated
Date Tue, 28 Jan 2003 22:38:35 GMT

Hmm... sounds strange.

1)  I've had no trouble with Postgres and storing dates.  Things don't
get truncated. So the truncation is probably happening somewhere between
the code and the database (ie, the village code is definitely storing
everything in seconds.)

2)  How do you know that it's being truncated?  Can we assume that
you've done something like 
'select to_char(WhenAdded, 'MM/DD/YY HH:MI') from profile'?

3)  You might try turning on SQL logging on the Oracle end to get the
exact insert statement that's sent to the database.  That's usually the
best way to track these things down.

Hope this helps.
On Tue, 2003-01-28 at 16:52, Geoff Fortytwo wrote:
> When I save timestamps, the values are truncated to dates.
> The field declaration in the schema is:
>    <column 
> name="whenAdded"   javaName="WhenAdded"   required="false"  type="TIMESTAMP"/>
> when I set the timestamp I do:
>    profile.setWhenAdded( new java.sql.Timestamp(System.currentTimeMillis()) );
> I've also tried
>    profile.setWhenAdded( new java.sql.Date(System.currentTimeMillis()) );
> and
>    profile.setWhenAdded( new java.util.Date(System.currentTimeMillis()) );
> No matter what, the date is saved to the database with the time truncated 
> so that only the date part of the timestamp is saved.
> I've put trace statements into the code and the value is definitely a 
> timestamp before and after I save the record, but when the record is 
> reloaded it's truncated. If I look at the value directly in the database, 
> it's always truncated after I insert it with torque. If I do the same 
> insert using a sql INSERT statement it saves the time in the field, so 
> there isn't anything in the database that's forcing the truncation.
> I'm using Oracle with Torque 3.0. I tried tracing the code through the 
> entire insert, but I get to the point where it goes into village and I 
> don't have that code. I suppose I could download it, but I'm not sure I can 
> figure this out. Does anyone have any ideas?
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-torque-user-help@jakarta.apache.org>

View raw message