wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Using SQL date() function in HQL Select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Using SQL date() function in HQL Select" Watch "Using SQL date() function in HQL Select" New topic
Author

Using SQL date() function in HQL Select

Asad Imtiaz
Greenhorn

Joined: Aug 01, 2008
Posts: 20
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

Joined: Aug 01, 2008
Posts: 20
Got it working. Used instead of date().


Problem solved
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using SQL date() function in HQL Select
 
Similar Threads
Problem with select query in hibernate
Basic Hibernate many-to-many mapping / query not right
Sequence Problem
org.hibernate.hql.ast.QuerySyntaxException: INFORMATION_SCHEMA.SYSTEM_ALIASES is not mapped.
error in running HQL Query