I'm working on a CMP 2 implementation that delegates to OpenJPA for
persistence. I'm running into a problem where I get the following
exception:
org.apache.openjpa.persistence.ArgumentException : More parameters
were passed to execute() than were declared: 4 parameters were
specified for query execution, but only 2 parameters were declared in
the query.
In CMP you declare finder and select methods that have parameters
which are passed into the query engine. You can have as many
parameters as you like but are not required to use them all, but it
appears that OpenJPA is enforcing a restriction where if the EJB-QL
text only lists say 2 parameters and I set 4 I get the above
exception. In order of perference:
Is this spec required? If not, can we remove the check?
Is there a way to disable the check? If so, how?
Is there a way to determine the number of paramters a query takes?
If so, I can change my code.
Is there a way to get the ejbql text from a Query object? If so, I'll
write a quick parser to determine number of queries myself.
BTW, I'm currently using 0.9.6.
Thanks,
-dain