Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic EJB QL  RSS feed

 
Leonard Nicol
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if someone can help me. I am querying an oracle database using the following EJB QL, SELECT OBJECT(e)FROM ReStores e WHERE "e.leases.expirationDate = '06-30-2006' which is built dynamically
On execution I get the following message: java.sql.SQLException : ORA-01843: Not a valid month.
The object being passed is a SimpleDateFormat type and I have formatted in various forms such as MM-dd-yyyy etc but still get the same error.
I am new to EJB QL and Java as a whole.
Thanks for your help.
Leonard
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would probably be easier to pass in the date as a parameter. If you're using a constant/literal value for the date, it has to be the number of seconds since 01/01/1970 at 00:00:00 GMT (just like System.currentTimeMillis() returns time in "milliseconds since...").
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you copy-paste all the EJB-QL's you have tried?
And be careful, the statement you have posted so farhad a typo (the quotes before e.leases)...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tryinstead of
[ October 15, 2003: Message edited by: Lasse Koskela ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!