-->
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.  [ 1 post ] 
Author Message
 Post subject: setting DetachedCriteria based on Date object in java
PostPosted: Wed Apr 15, 2009 1:49 pm 
Newbie

Joined: Thu Jun 19, 2008 3:23 pm
Posts: 4
Hi,
Who can we set Restrictions base on date in DetachedCriteria.

For instance

I have date type in oracle database which is of format YYYY-MM-DD HH:MM:SS and i would like to get all result which is greater than or equal to current date.

DetachedCriteria dc = DetachedCriteria.forClass(Product.class);
dc.add(Restrictions.ge("expDate", current Date));
List<NotExpiredProducts> notExpProducts= getHibernateTemplate().findByCriteria(dc);

Any sample code if possible.

Any help would be greatly appricated.


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

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.