Hi, I have a problem with an EjbQl: on my scenario, there are 2 entity beans: Bean1 and Bean2. There is a unidirectional relation between Bean2 and Bean1 (M:1).
On my Bean2 I have an EjbQl (findXXX) returning a Collection, like this:
SELECT DISTINCT o.bean1 FROM bean2 AS o WHERE bean2.bean1.code=?1
When I try to cicle on the collection to retrieve every single element,
a ClassCastException is thrown:
example:
//-->BEGIN<--
// we are on a session facade........
Collection all = Bean2LocalHome.findXXX(code);
Iterator itr = all.iterator();
while (itr.hasNext()){
Bean1 bean1 = (Bean1)itr.next();//--> ClassCastException!!!!!
.....
}
//-->END<--
I don't understand: the finder is defined on Bean2 but it should return
a Bean1 collection...or not ?
Thanks
Davide
signature.asc
Description: PGP signature
