-->
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: How can I make Date comparison in HQL query
PostPosted: Thu Apr 22, 2004 1:09 am 
Newbie

Joined: Sun Apr 18, 2004 2:29 am
Posts: 18
hi
i am in difficulty of writing a correct Date comparison hql query.

i have wrote the following query--

public Collection getPeriodicalApplicationList(Session session, Date fromDate, Date toDate) throws DaoException{
try{
String queryString = "from DeskProcessDto dto where dto.applicationDesk.applicationDateType between :param1 and :param2";
Query query = session.createQuery(queryString);
query.setString("param1", DateFormatter.getInstance().format(fromDate, DateFormatter.getInstance().DATE_PATTERN_DD_MMM_YY));

query.setString("param2", DateFormatter.getInstance().format(toDate, DateFormatter.getInstance().DATE_PATTERN_DD_MMM_YY));

return query.list();
}catch(HibernateException _hbx){
_hbx.printStackTrace();
throw new DaoException(_hbx);
}
}

but it is not giving me the desired result

please would any one tell me how can i get all the records which fall between two particular record

thanx
Samim


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 22, 2004 3:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Why don't you use query.setDate() ?


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.