-
1. Re: EJB QL and time comparison
hmae Feb 3, 2005 12:04 PM (in response to hmae)The EJB QL I posted was incorrect. It should have read:
select object(c) from tableschema as c where c.start_date between ?1 and ?2
This is what I have, and I still need a way to pass hours and minute information.
Thanks for any help you can give me. -
2. Re: EJB QL and time comparison
didi1976 Feb 10, 2005 6:45 AM (in response to hmae)Try using java.sql.Timestamp instead of java.sql.Date. AFAIK Date sets the hour, minute, second, ... to 0 to be conform to the standard.
-
3. Re: EJB QL and time comparison
jamesstrachan Feb 10, 2005 8:02 AM (in response to hmae)An alternative approach is to strip all the time information from the date before storing the date in the database.
This works well in commercial applications but may not suit your application.
James -
4. Re: EJB QL and time comparison
hmae Feb 10, 2005 8:31 AM (in response to hmae)Thank you for the replies.
The application that I am working on tries to do a search by the name of the table fieldname and the value. I discovered that when I try to do a search on a date (ex. 01/27/2005), I will get data for 01/27/2005 00:00:00AM. And it did not get data for other times (ex. 01/27/2005 15:59:00 PM). Which is why I needed to pass time stamp information. When data get inserted, the time information must be kept so that we can calculate how long it took for the job to be completed.
I will try the java.sql.Timestamp.
Worst comes to worst I think the other option would be to get all the data first and iterate it in a loop, get the date fields and convert it to a string, and compare the string values.
Thank you for all your help.