Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Using SQL date() function in HQL Select

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys

I am running into a problem using Hibernate, basically I need to translate the follow SQL (to HQL)



to HQL (which i am doing as follows)




Now this gives me the following exception



but if I run the same HQL without the sql date() function in the select clause the HQL gives no exception but thats not the result I want.


Now the reason I am using the date() function is that my date column is database table is of type "timestamp" which means the format is like "dd/mm/yyyy hh:mm:ss".



Now what I have to do in my query is to group by the date part i.e. (dd/mm/yyyy) and the status.

Any idea how can i achieve this using HQL ?




What I am using is

-Hibernate 3.2.2ga
-EnterpriseDB
-JDK 1.5




Thank you.










 
Asad Imtiaz
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it working. Used instead of date().


Problem solved
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic