I am using a Hibernate query for getting data from a table between two DATES. e.g., between 20/07/2007 to 31/08/2007. The problem is Hibernate is not taking the END date. Its taking date before the end date i.e., 30/08/2008.
You will have to test out a couple of things (as i mentioned in my earlier post).
1) What is the exact SQL query that gets generated out of this HQL? You will find this in the log files (i guess show_sql should be turned on in the hibernate config file)
2) How does this query behave with dates before Febraury 28 2008. Remember that 2008 is a leap year and i have seen JDK bugs being reported related to leap year. If this turns out to be because of the JDK you are using, you will have to upgrade to a latest JDK.
What is the data type of the date column you're querying against? Does it include a full time stamp?
A possible problem, if that's the case, is your method of passing a date string with no time information may be resulting in passing in a end date for your between that is set to date + time of 12:00:00 am, which would probably exclude any actual records for the day (e.g., they happened after the clock struck midnight).
There will always be people who are ahead of the curve, and people who are behind the curve. But knowledge moves the curve. --Bill James
Joined: Dec 04, 2006
Thanks Stevi Deter.
Ingoba, The first question to answer is: what is the value stored in the database column you are querying against? Is it a pure date, or a date and time field?
If this is not the case (you're querying a field that has just date information and no time information) then this probably isn't your problem.