Re: javadb problem pls help
When you say that it doesn't work, do you mean that you don't get the answer you expect, or that it throws an exception?
Looking at your query, I think there could be several problems. First off, you are trying to match the column named "location" with a String that represents a date. Remember, when you concatenate strings together with a Date object, Java will call the toString() method on that date object and convert it to a String.
If indeed this "location" column holds dates instead of addresses or cities (check the data) then you will need to either convert the "location" field to characters (a string) or convert the date (which has been converted to a String) back to a date.
You can use standard SQL to convert either like:
where to_char('MMDDYYYY',location)='07192010'
Or
where location = to_date('date','MMDDYYYY')
Where the MMDDYYYY is the format that the location field is set to, or you won't get a match.
The best way in my opinion is to to_char the date in your SQL, and format your date object in Java using the SimpleDateFormat class. That way you can ensure they are both of the same exact format when comparing.
Since you are using Hibernate, you can use the built in HQL functions for converting dates to chars or visa-versa. I don't write a whole lot of custom HQL so I don't know the syntax off of the top of my head.
Re: javadb problem pls help
First of all, I agree with ProgramThis about the "location" vs date thing. You should check that first.
In this code
Code:
List result = session.createQuery("from Presentation.Appoinment where location=\'"+date+"\'").list();
I was wondering why your are escaping the ticks (\') in your strings? It isn't necessary and could be causing problems.
Another thing you can try is to set show_sql to true in your hibernate.config.xml
Code:
<property name="hibernate.show_sql">true</property>
This will output the SQL commands as the are sent to the database. It may give you some hint as to what is going on.
As ProgramThis said, if this doesn't help, post back with the specific errors you're having.
Please use code tags around code and exception stack traces.