Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date problem in EJBQL

843830Aug 10 2010 — edited Aug 10 2010
Hi, the code gives an IllegalArgument Exception while setting the second parameter of the query.Does anyone has any idea?i have to use indexes while setting parameters.i am using ejb 3.0
EntityManager em=....;

Query q= em.createQuery("select t from myentity t where t.myString in :myString and t.myDate in  :myDate");

List <String> stringList=new ArrayList<String>();
stringList.add("a");
stringList.add("b");

SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
List <Date> dateList=new ArrayList<Date>();
dateList.add(sdf.parse("30/12/2001"));
dateList.add(sdf.parse("30/12/2002"));

q.setParameter(1,stringList);
q.setParameter(2,dateList); //here an Illegal argument exception occurs
Edited by: ihsanihsan on Aug 10, 2010 12:11 PM

Edited by: ihsanihsan on Aug 10, 2010 12:15 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2010
Added on Aug 10 2010
3 comments
105 views