-->
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.  [ 4 posts ] 
Author Message
 Post subject: hhow to get date part using HQL
PostPosted: Fri Apr 11, 2008 2:43 am 
Newbie

Joined: Fri Apr 11, 2008 2:17 am
Posts: 2
i would like to get the date part of value in the Date variable column from the database..
How can i write my hql to get ony the date part...
ie
to get "2008-04-30" from the value "2008-04-30 07:30:00"....

i need it to compare with an incoming value of the format "2008-04-30"

thanks in advance...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 3:07 am 
Regular
Regular

Joined: Mon Aug 06, 2007 10:49 am
Posts: 67
Location: Banska Bystrica, Slovakia
may u could map your column second time and using formula specify sql function of your db to convert datime to date and then execute your hql against this property

<porperty ...
formula="function(column)"
/>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 4:45 am 
Newbie

Joined: Fri Apr 11, 2008 2:17 am
Posts: 2
Thanks for timely reply.
I am using mySQL as my DB.
I am not aware of a mySQL function for doing this conversion.
We can use "SELECT LEFT('2004-08-27 12:38:54',10) ;".Is there any way like this which can be applied in my HQL...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 2:35 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Just read the date as 'select date from mytable'

then read date from your POJO and you can compare it with other dates.


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

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.