aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate: Getting time/date in simple sql queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate: Getting time/date in simple sql queries" Watch "Hibernate: Getting time/date in simple sql queries" New topic
Author

Hibernate: Getting time/date in simple sql queries

Jacek D.
Greenhorn

Joined: Nov 25, 2004
Posts: 1
Hello,

My problem is quite easy. I need to get a database date/time to using query like this: SELECT now() or SELECT CURRENT_TIMESTAMP.

HQL treats now() or CURRENT_TIMESTAMPS as aliases (I don't know how to tell him to pass these to sql). That's why I tried using createSQLQuery function, however it requires specyfing return class. What class should I use? I was trying different combinations, for example:




however it gives following exception:



This seems strange to me as I don't have to map library classes.

I suppose the solution is straightforward and it's just my incompetence that causes problems

Help!
jacek
[ November 25, 2004: Message edited by: Jacek D. ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Getting time/date in simple sql queries
 
Similar Threads
please help me about EJB-QL......
Problem in EJB QL Finder Method.....
Timestamp assistance
date operations in Hibernate
Restore problem