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.  [ 2 posts ] 
Author Message
 Post subject: HQL - createQuery Date Compare
PostPosted: Wed Feb 07, 2007 1:28 pm 
Newbie

Joined: Wed Jan 10, 2007 1:40 pm
Posts: 12
Is there a way to compare dates using HQL where you can someone string the query together in a string. I know about setParameter but I would like to string together a query purely string


I want to be able to build a filter based on string only

Query summaryQuery = session.createQuery("from DPHeaderVO " + sqlSuffix);

where sqlSuffix would be a list of criteria which has date objects.

sqlSuffix ="where startDate <='somedate'"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 8:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You can by using native SQL to do the conversions. Obviously, its not pure HQL thus its not portable across most platforms.

for example Oracle;
sqlSuffix ="where to_char(startDate,'dd/mm/yyyy' <='10/02/2007'"


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.