aspose file tools*
The moose likes Object Relational Mapping and the fly likes HQL 2 – how to say “within X days from today”? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL 2 – how to say “within X days from today”?" Watch "HQL 2 – how to say “within X days from today”?" New topic
Author

HQL 2 – how to say “within X days from today”?

John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
Hi,
My db is oracle and hibernate 2.
I have this persistent class



I want to get all the rows that their creationDate is within X days from today.


Thanks a lot!
Javid Jamae
Author
Ranch Hand

Joined: May 14, 2008
Posts: 198
"Within X days" == "less than (or equal to) today's date + X days"

Does that help?


Author: JBoss in Action, javidjamae.com, @javidjamae on Twitter
John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
my problem is hql not logic
Thanks
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
"from MyClass mc where mc.creationDate >= ? and mc.creationDate <= ?",today, (today+X days)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HQL 2 – how to say “within X days from today”?
 
Similar Threads
How to insert todays date into Database using Entity
Repaint method not working from button call
Repaint method not working from button call
How to get difference between dates
Calander class - calc the num of months weeks and days