Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling Date in Hibernate

 
Sujatha Kumar
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Stan Sokolov
Ranch Hand
Posts: 120
Hibernate IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic