Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding or in criteria query

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to write a criteria query in Hibernate using which i can select dates of a particular month for multiple years(four years in total).

For example I want it fetch the rows for whose date should be
between
(1st april 2011 and 1st May 2011) or the date should be between
(1st april 2010 and 1st May 2010) or the date should be between
(1st april 2009 and 1st May 2009) or the date should be between
(1st april 2008 and 1st May 2008)

TIA,
Ankit
 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ankit,

you can use the Restrictions class in hibernate to achive this....


Here is a sample.



hope this helps.
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anantha,

It worked really well. You saved my day. Thanks a lot.

Thanks and Regards,
Ankit Chandrawat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic