You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Catalina Wei (JIRA)" <ji...@apache.org> on 2009/01/23 03:47:59 UTC

[jira] Created: (OPENJPA-865) JPA2 Query support for collection-valued input parameters

JPA2 Query support for collection-valued input parameters
---------------------------------------------------------

                 Key: OPENJPA-865
                 URL: https://issues.apache.org/jira/browse/OPENJPA-865
             Project: OpenJPA
          Issue Type: Sub-task
            Reporter: Catalina Wei
            Assignee: Catalina Wei




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


[jira] Updated: (OPENJPA-865) JPA2 Query support for collection-valued input parameters in IN Expression predicate

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

Catalina Wei updated OPENJPA-865:
---------------------------------

    Description: 
Support for collection-valued parameters in JPA2 Spec in 

considering the followoing query:

   select e from CompUser e where e.age in (10, 20, 30)

when using input parameters for each in-item,  the query would rewrite to:

  select e from CompUser e where e.age in (?1, ?2, ?3)

each in-item contains a single value.

JPA2 syntax allows in-item in the in-expression predicate to contain multiple values such that the above query can be :

     select e from CompUser e where e.age in ?1
   
or
   
    select e from CompUser e where e.age in :ages

  the parameters in these 2 queries contain more than 1 value, the caller on Query interface will do something like the following:

// first create collection that holds values for the parameters
   Collection ages = new ArrayList();
   ages.add(10);
   ages.add(20);
   ages.add(30);

// issue query using new syntax and passing collection valued parameter
   List rs = em.createQuery("select e from CompUser e where e.age in :ages").setParameter("ages", ages).getResultList();

Note that when collection valued parameter is used, the in-item is not enclosed in parenthesis;
   the following query would only allow :ages to contain a single value:
       
    select e from CompUser e where e.age in (:ages)
        Summary: JPA2 Query support for collection-valued input parameters in IN Expression predicate  (was: JPA2 Query support for collection-valued input parameters)

> JPA2 Query support for collection-valued input parameters in IN Expression predicate
> ------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-865
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-865
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>
> Support for collection-valued parameters in JPA2 Spec in 
> considering the followoing query:
>    select e from CompUser e where e.age in (10, 20, 30)
> when using input parameters for each in-item,  the query would rewrite to:
>   select e from CompUser e where e.age in (?1, ?2, ?3)
> each in-item contains a single value.
> JPA2 syntax allows in-item in the in-expression predicate to contain multiple values such that the above query can be :
>      select e from CompUser e where e.age in ?1
>    
> or
>    
>     select e from CompUser e where e.age in :ages
>   the parameters in these 2 queries contain more than 1 value, the caller on Query interface will do something like the following:
> // first create collection that holds values for the parameters
>    Collection ages = new ArrayList();
>    ages.add(10);
>    ages.add(20);
>    ages.add(30);
> // issue query using new syntax and passing collection valued parameter
>    List rs = em.createQuery("select e from CompUser e where e.age in :ages").setParameter("ages", ages).getResultList();
> Note that when collection valued parameter is used, the in-item is not enclosed in parenthesis;
>    the following query would only allow :ages to contain a single value:
>        
>     select e from CompUser e where e.age in (:ages)

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


[jira] Resolved: (OPENJPA-865) JPA2 Query support for collection-valued input parameters in IN Expression predicate

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

Catalina Wei resolved OPENJPA-865.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

code checked in under trunk svn r738940

> JPA2 Query support for collection-valued input parameters in IN Expression predicate
> ------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-865
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-865
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>             Fix For: 2.0.0
>
>
> Support for collection-valued parameters in JPA2 Spec in 
> considering the followoing query:
>    select e from CompUser e where e.age in (10, 20, 30)
> when using input parameters for each in-item,  the query would rewrite to:
>   select e from CompUser e where e.age in (?1, ?2, ?3)
> each in-item contains a single value.
> JPA2 syntax allows in-item in the in-expression predicate to contain multiple values such that the above query can be :
>      select e from CompUser e where e.age in ?1
>    
> or
>    
>     select e from CompUser e where e.age in :ages
>   the parameters in these 2 queries contain more than 1 value, the caller on Query interface will do something like the following:
> // first create collection that holds values for the parameters
>    Collection ages = new ArrayList();
>    ages.add(10);
>    ages.add(20);
>    ages.add(30);
> // issue query using new syntax and passing collection valued parameter
>    List rs = em.createQuery("select e from CompUser e where e.age in :ages").setParameter("ages", ages).getResultList();
> Note that when collection valued parameter is used, the in-item is not enclosed in parenthesis;
>    the following query would only allow :ages to contain a single value:
>        
>     select e from CompUser e where e.age in (:ages)

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


[jira] Work started: (OPENJPA-865) JPA2 Query support for collection-valued input parameters

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

Work on OPENJPA-865 started by Catalina Wei.

> JPA2 Query support for collection-valued input parameters
> ---------------------------------------------------------
>
>                 Key: OPENJPA-865
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-865
>             Project: OpenJPA
>          Issue Type: Sub-task
>            Reporter: Catalina Wei
>            Assignee: Catalina Wei
>


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