• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Need HQL query

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic