my dog learned polymorphism*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling Date in Hibernate