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

Hibernate Select - Criteria with a Date

 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate appears to be using a 'fasttime' value?? for my date in its WHERE clause and doesn't return rows that it should from the database:

Here's a 50K foot view of my Doman and DAO objects along with the SQL output.
I'm using annotations for hibernate and have set the temporal type for my date objects to DATE (I've tried all three)

DOMAIN:


DAO:


My variables output shows that the start and end date 'criterion' are pointing to the correct property name, but when it comes to the actual value, cdate is null and fasttTme is 1304139600000.

Unfortunately, my log4j.xml isn't responding to TRACE, so I am not able to see the actual parameters I'm hoping I'm still on the right track.

Here's what Hibernate has for a query:


when I use the values from fastTime values, the rows do not come back.
when I use the 'yyyy-MM-dd' equivalent of the fast time values, the query does work.

This is how I was able to confirm the equivalent from the fastTime:



Hoping for a little nudge in the right direction.

Thanks!


 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a thought. Can we not annotate and override the getter methods of dates to return values of desired type?
 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many apologies folks. False alarm. the dates weren't even the issue. it was a separate criteria that was the culprit.

For some reason I keep having to relearn the lesson of 'elimination'.
Start removing various factors to weed out the cause.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic