This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Handling Date in Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Handling Date in Hibernate" Watch "Handling Date in Hibernate" New topic
Author

Handling Date in Hibernate

Sujatha Kumar
Ranch Hand

Joined: Jan 05, 2004
Posts: 134
Hi,

I am trying to fetch records based on date, but unfortunately
the records are not getting listed eventhough the records
does exist in DB.

I have tried with the following parameters in the SetParameter
method but no use.

Hibernate.TIMESTAMP
Hibernate.DATE

Any suggestions is highly appreciated, following are my coding
snippets.

Query
=====


Cofiguration
============


Pojo
====


Regards


SCJP,SCWCD,SCBCD,SCEA Part I
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Start by mapping the property as timestamp as date truncates the time portion. Have you looked at the generated SQL to see if it's affected by the datatype specified?
Stas Sokolov
Ranch Hand

Joined: Apr 13, 2004
Posts: 117

As as as I know Hibernate does not allow to use "greater: and lesser symbols. Use >, <.
Probably this is not the case but at least try


Good luck for yourself.
Stas Sokolov
Ranch Hand

Joined: Apr 13, 2004
Posts: 117

No it is not the case because you dinamically create a query. My advice applicable only if you load queries from the file
Sujatha Kumar
Ranch Hand

Joined: Jan 05, 2004
Posts: 134
Actually speaking hibernate query language supports > < >= <=.
I was able to solve this problem by using to_date(to_char functions
in my hibernate query language
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Handling Date in Hibernate
 
Similar Threads
Foreign key in hibernate
bean cannot be found in any scope
Lazy loading not working as expected
Hibernate Select - Criteria with a Date
List "key Column" and "List Index" values null.