-->
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 Date Query
PostPosted: Fri Mar 10, 2006 10:46 pm 
Newbie

Joined: Tue Sep 21, 2004 1:33 pm
Posts: 5
I'm looking for help in writing an HQL query that finds all objects that equal today's date or greater given an objects date property.

This seems pretty straight forward but I can't seem to find a good example.

I'm using Hibernate 3.1.2 and MySql 4.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 11, 2006 8:00 am 
Regular
Regular

Joined: Tue Mar 07, 2006 11:18 am
Posts: 54
Location: Berlin
Does every Entity has got a date Property?

So lets say you have a couple of entities in the same class hierarchy all of them have these "date" Property you could do a simple criteria query like:

Code:
Criteria criteria = session.createCriteria(Father.class);
criteria.add(Restrictions.or(Restrictions.ge("date",new Date()),Restrictions.ge("date",otherDate));


simon


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.