-->
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: Time value in Java Date object not used in query
PostPosted: Thu Aug 19, 2010 10:21 am 
Newbie

Joined: Thu Aug 19, 2010 10:10 am
Posts: 1
Hello,

I have an issue with my HQL, I need to perform a query on a table with a dateTime field.
I need to return rows of records between two Datetimes specified. The problems is that the Java Date object (which contains a time value) is being translated into a date with the year and month only, time is not included in the query.

What do I need to do to include the time of the date object in my query value?
Any help would be greatly appreciated :)


Hibernate Code in JAVA
Code:
return DataAccessUtils.intResult(hibernateTemplate.find("SELECT COUNT(*) FROM Activitylog WHERE activityCode = ? AND (date between ? AND ? )", new Object[]{event,dateFrom, dateTo}));



Final SQL output in MYSQL log
Code:
SELECT count(*) as col_0_0_ from Activitylog activitylo0_ where activityCode='U_LOG_IN' and (date between '2010-08-19' and '2010-08-19')


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.