[ 
https://issues.apache.org/jira/browse/OPENJPA-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508543
 ] 

Patrick Linskey commented on OPENJPA-267:
-----------------------------------------

I just checked in a new test case (TestMethodQLQuery.java, r551159) to serve as 
a point of discussion.

In my opinion, we should:

1. not require parameters to be declared for MethodQL queries

2. not require the result class to be specified for MethodQL queries

I believe that the only value for having this data is for the query cache in 
the context of MethodQL, and I don't believe that we cache MethodQL queries 
anyways.

> MethodQL unnecessarily requires a call to declareParameters()
> -------------------------------------------------------------
>
>                 Key: OPENJPA-267
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-267
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 0.9.0, 0.9.6, 0.9.7
>            Reporter: Patrick Linskey
>             Fix For: 1.0.0
>
>
> OpenJPA should be able to infer the parameters from the signature when there 
> is no method overloading, and in the case where there is method overloading, 
> it'd be nice if OpenJPA would allow the args specification to happen inline 
> in the method declaration.
> More context:
> On 6/26/07, e33238 <[EMAIL PROTECTED]> wrote:
> > 
> > I'm tracing through the code to find out what the problem was, and it seems
> > that it'll work if I do this:
> > 
> > OpenJPAQuery q =
> > oem.createQuery("openjpa.MethodQL","com.xyz.Finder.getByName");
> > q.setResultClass(Person.class);
> > q.setParameter("firstName", "Fred").setParameter("lastName", "Lucas");
> > ((QueryImpl)q).getDelegate().declareParameters("String firstName, String
> > lastName"); //<== additional line
> > List results = q.getResultList();
> > 
> > Now getByName() will be called correctly, with "firstName" and "lastName" in
> > the "params" map. I'm sure this is not the correct way, but I couldn't
> > figure out how else I can call declareParameters(). Without calling
> > declareParameters(), I'll get the ArgumentException.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to