persistence@glassfish.java.net

Problem binding collections to queries

From: Christian Kerwer <Christian.Kerwer_at_t-online.de>
Date: Thu, 7 Feb 2008 09:57:31 +0100

Hi everyone

 

I'm trying to bind a collection of Ids into a Query like this:

Select p from Project p where p.id IN (:IdList)

with IdList as Array of Long and field p.id of type Long.

 

It will be quitted with the following exception:

java.lang.ClassCastException:

You have attempted to set a value of type class [Ljava.lang.Long; for
parameter planningObjectIdList with expected type of class java.lang.Long
from query string select planObjStrLnk from PlanningObjectStructureLink
planObjStrLnk where planObjStrLnk.planningClassStructure.id =
:planningClassStructureId and planObjStrLnk.planningObject.id in
(:planningObjectIdList)

 

 

Any Idea?

 

Christian Kerwer