-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Getting back timestamp column with millisecond precision
PostPosted: Tue Nov 09, 2010 8:20 am 
Beginner
Beginner

Joined: Mon Aug 23, 2004 12:44 am
Posts: 25
I've got a named query which has a date comparison in the where clause ( x.statusdate <= :systemDate).
The systemDate is a named parameter and is a java.util.Date.
The x.statusdate is a java.util.Date and is mapped with type=java.util.Date in the hbm file.

So, the query needs to select entries of which the statusdate (up to the millisecond precision !!!) is smaller than or equal than the current system time (this is parameter 1 below).

The question I have is whether the value shown (see below) for the binding is actually the value that will be used in the query to do the comparison ?
If so, then there's a problem because the shown value doesn't contain any milliseconds.
If not, then I guess it's a bug in the trace formatting of the date value ?

Regarding the resultset. In there I can see when debugging that it contains my resulting objects and the x.statusDate is of type java.util.Timestamp and contains milliseconds. However the trace output (see below) seems to truncate the milliseconds ?
Again, is this an error in the trace output's formatting, or is the returned value indeed truncated and are the milliseconds lost ?

So bottomline the question is whether my query will only select those entries that are smaller than or equal to the given system date taking into account milliseconds ?

Code:
[TRACE] org.hibernate.jdbc.AbstractBatcher - preparing statement
[TRACE] org.hibernate.type.TimestampType - binding '2010-11-09 12:50:18' to parameter: 1
[DEBUG] org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
...
[TRACE] org.hibernate.type.TimestampType - returning '2010-11-09 10:57:34' as column: CREATIE10_4_
...


Thanks,
EDH


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.