You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2007/06/27 13:52:26 UTC

[jira] Created: (OPENJPA-267) MethodQL unnecessarily requires a call to declareParameters()

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.7, 0.9.6, 0.9.0
            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 <e3...@hotmail.com> 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.


[jira] Updated: (OPENJPA-267) MethodQL unnecessarily requires a call to declareParameters()

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey updated OPENJPA-267:
------------------------------------

    Fix Version/s:     (was: 1.0.0)

> 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
>
> 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 <e3...@hotmail.com> 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.


[jira] Commented: (OPENJPA-267) MethodQL unnecessarily requires a call to declareParameters()

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ 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 <e3...@hotmail.com> 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.


[jira] Commented: (OPENJPA-267) MethodQL unnecessarily requires a call to declareParameters()

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508533 ] 

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

My earlier summary makes no sense at all in the context of MethodQL.

Digging into this further: maybe in MethodQL we should just not require parameters to be declared at all, and let the method impl do whatever param checks are necessary. Additionally, I do not believe that the result class setting should be required.

> 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 <e3...@hotmail.com> 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.