the parameter p0 is just a collection of objects of the same type as the
field we're testing against..
here is what I'm currently thinking. 'field' could be string, or int,
or another entity. the ':col' is a collection of the same type as
'field'.
this is what we do with jdo:
:col.contains( field )
this is what I would like to do with jpa:
field member of :col
going over the jpql documentation in fine detail, it looks like the
member-of operator doesn't allow a parameter on the right hand side.. (
if I'm reading it correctly ).. in that case I have to use the "in"
operator, which is much less convenient:
this is what I think I am forced to do with jpa:
(to break out the collection into it's elements, and add them to the
query, :col_a, :col_b, :col_c are the elements within the collection )
field in ( :col_a, :col_b, :col_c )
So I would walk through the collection, and add appropriate placeholders
for the correct number of elements.. then set those parameters with the
elements from the collection. This sucks because I have to actively
change the query depending on the size of the collection, when
semantically it means the same when I say "field member of :col" and let
OpenJpa do what it has to to turn that into a query...
any more questions? Is this of enough detail?
Pinaki Poddar wrote:
Please post the related code snippets that sets the parameter 'p0' of the
query.