-->
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: query for retrieving entities between the given dates
PostPosted: Thu Aug 10, 2006 3:24 am 
Newbie

Joined: Thu Aug 10, 2006 3:03 am
Posts: 1
I have taken a property 'hiredate' as java.util.Date in the javabean

and mapped to the column hiredate(date) in MySQL database

now i want to generate a query for retrieving the entities between the range of dates

note: date format choosen is 'yyyy-mm-dd'

awaiting the response from u my friend

_________________
thanks for ur reference
expecting ur reply


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 8:43 am 
Expert
Expert

Joined: Thu Sep 22, 2005 10:29 am
Posts: 285
Location: Almassera/Valencia/Spain/EU/Earth/Solar system/Milky Way/Local Group/Virgo Supercluster
Are you asking for something like this?
Code:
Date start = something;
Date end = otherthing;
String hql = "from classname x where :startDate <= x.hiredate and x.hiredate <= :endDate";
List items = Session().createQuery(hql)
   .setDate("startDate", start)
   .setDate("endDate", end)
   .list();


Don't forget to rate me if I helped you.


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.