You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "David Blevins (JIRA)" <ji...@apache.org> on 2011/05/13 19:14:47 UTC

[jira] [Created] (OPENJPA-1999) Optional support for non-sequential positional parameters

Optional support for non-sequential positional parameters
---------------------------------------------------------

                 Key: OPENJPA-1999
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
             Project: OpenJPA
          Issue Type: Improvement
          Components: competitive, jpa, query, usability
            Reporter: David Blevins


Optional support for less strict following of positional parameters. e.g.

    Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
    query.setParameter(2, "Foo"); 
    query.setParameter(4, 2011); 
    return query.getResultList(); 

Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Created] (OPENJPA-1999) Optional support for non-sequential positional parameters

Posted by Rick Curtis <cu...@gmail.com>.
I somehow missing this email when you sent it originally.....  and we must
be smoking the same mushrooms because this the exact path that I went down.

On Fri, May 13, 2011 at 1:18 PM, <in...@dvholten.de> wrote:

> hi folks,
> i am just following the discussion about the positional parameters.
> isnt it possible to think about positional parameters just as
> 'named-by-numbers' parameters?
> when its possible to use q.setParameter( "x", something ) and
> q.setParameter( "y", anotherthing )
> then i ( without smoking too many mushrooms ) can imagine that the 2 in
> q.setParameter( 2, whatever )
> is very similar to "2". So, the parameter index is not like an
> array-index, but like a key in a map.
> when you can handle named parameters, non-sequential index parameters
> shouldnt be too difficult ..
> - technically - what the standard says might another thing.
>
>
> hth
> dvh
>
>


-- 
*Rick Curtis*

[jira] [Assigned] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Rick Curtis reassigned OPENJPA-1999:
------------------------------------

    Assignee: Rick Curtis

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Michael Dick updated OPENJPA-1999:
----------------------------------

    Fix Version/s: 2.1.1

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>             Fix For: 2.1.1, 2.2.0
>
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Rick Curtis resolved OPENJPA-1999.
----------------------------------

    Resolution: Fixed

Resolving issue. 

I created OPENJPA-2029 to address Pinkai's testing concerns.

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>             Fix For: 2.1.1, 2.2.0
>
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-1999) Optional support for non-sequential positional parameters

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049237#comment-13049237 ] 

Pinaki Poddar commented on OPENJPA-1999:
----------------------------------------

The commit shows no tests with PreparedQuery. In a related thread, it had been discussed that a change of this nature *may* impact PreparedQuery.
How about executing few of the queries with non-kosher binding parameter twice so that the second time the parameters get rebind?

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Rick Curtis updated OPENJPA-1999:
---------------------------------

    Fix Version/s: 2.2.0

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Albert Lee closed OPENJPA-1999.
-------------------------------


Close issue in preparation for 2.2.0 release.
                
> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>            Assignee: Rick Curtis
>             Fix For: 2.1.1, 2.2.0
>
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Created] (OPENJPA-1999) Optional support for non-sequential positional parameters

Posted by in...@dvholten.de.
hi folks,
i am just following the discussion about the positional parameters.
isnt it possible to think about positional parameters just as 
'named-by-numbers' parameters?
when its possible to use q.setParameter( "x", something ) and 
q.setParameter( "y", anotherthing )
then i ( without smoking too many mushrooms ) can imagine that the 2 in 
q.setParameter( 2, whatever ) 
is very similar to "2". So, the parameter index is not like an 
array-index, but like a key in a map.
when you can handle named parameters, non-sequential index parameters 
shouldnt be too difficult ..
- technically - what the standard says might another thing.


hth
dvh


[jira] [Updated] (OPENJPA-1999) Optional support for non-sequential positional parameters

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

Rick Curtis updated OPENJPA-1999:
---------------------------------

    Attachment: OPENJPA-1999.patch

@David -

Please give the attached patch a try. I'll note that it's still a little fluid, but I'd like to get confirmation that it works for you before spending much more time going down this path.

Since this behavior goes against the spec and it worked for one reason or another in a previous release, I'm not planning on enabling this functionality by default. To enable support for this feature, you'll have to set a new comparability flag[1].

The gist of this patch is that I mapped all positional parameters to a stringified version of the param ($1=>:_1). This way the runtime thinks the user has named parameters and the user thinks they're using positional parameters.

[1]openjpa.Compatibility=ConvertPositionalParametersToNamed=true

> Optional support for non-sequential positional parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1999
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1999
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa, query, usability
>            Reporter: David Blevins
>         Attachments: OPENJPA-1999.patch
>
>
> Optional support for less strict following of positional parameters. e.g.
>     Query query = entityManager.createQuery("SELECT m from Movie as m WHERE m.title = ?2 AND m.year = ?4"); 
>     query.setParameter(2, "Foo"); 
>     query.setParameter(4, 2011); 
>     return query.getResultList(); 
> Previous OpenJPA releases support this as do current EclipseLink and Hibernate versions.  For the migration and upgrade scenarios and the development scenario -- can be a pain to have to always update positional parameters while tweaking queries -- this could make a compelling optional feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira