Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Within X days" == "less than (or equal to) today's date + X days"

Does that help?
 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my problem is hql not logic
Thanks
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"from MyClass mc where mc.creationDate >= ? and mc.creationDate <= ?",today, (today+X days)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic