• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need HQL query

 
ravi pamuru
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im using year to fetch the rcords in the oracle10g but how to convert the date to year i don't know. If anyone knows please let me know. Following is the query that i want to convert holidays.date to year.

executeQuery("from EIPublicHolidayBean holidays where holidays.date=:searchYear","searchYear",year);

ThanksandRegards,
Ravi
 
Jason Ferguson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi,

What type is year? Is it java.util.Date or java.sql.Date?

Also, have you considered the Criteria API? It would likely look something like this:



Jason

Originally posted by ravi pamuru:
Hi,

Im using year to fetch the rcords in the oracle10g but how to convert the date to year i don't know. If anyone knows please let me know. Following is the query that i want to convert holidays.date to year.

executeQuery("from EIPublicHolidayBean holidays where holidays.date=:searchYear","searchYear",year);

ThanksandRegards,
Ravi
 
ravi pamuru
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jason,

Thanks for your reply. But i managed the query like below.



Is it have any defects?, while using the query like this.

Thanks&Regards,
Ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic