openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Azuo Lee (JIRA)" <j...@apache.org>
Subject [jira] Updated: (OPENJPA-1828) Query with expression IN (collection_valued_input_parameter) gives wrong result when executed the second time
Date Thu, 07 Oct 2010 18:36:30 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Azuo Lee updated OPENJPA-1828:
------------------------------

    Description: 
for (int i = 0; i < 2; i ++) {
    List categories = new LinkedList();
    categories.add("01");
    categories.add("02");
    categories.add("03");
    Query q = entityManager.createQuery("select v.id from Category v where v.id in (:p) order
by v.id asc");
    q.setParameter("p", categories);
    List results = q.getResultList();
    for (Iterator it = results.iterator(); it.hasNext(); )
         System.out.print(it.next() + ", ");
    System.out.println();
}

The above code will produce the following output:
01, 02, 03,
02, 03,

"01" is missing when the second time the same query is executed.

  was:
for int (i = 0; i < 2; i ++) {
    List categories = new LinkedList();
    categories.add("01");
    categories.add("02");
    categories.add("03");
    Query q = entityManager.createQuery("select v.id from Category v where v.id in (:p) order
by v.id asc");
    q.setParameter("p", categories);
    List results = q.getResultList();
    for (Iterator it = results.iterator(); it.hasNext(); )
         System.out.print(it.next() + ", ");
    System.out.println();
}

The above code will produce the following output:
01, 02, 03,
02, 03,

"01" is missing when the second time the same query is executed.


> Query with expression IN (collection_valued_input_parameter) gives wrong result when
executed the second time
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1828
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1828
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>         Environment: openjpa-2.1.0-20101001.064809-70
>            Reporter: Azuo Lee
>
> for (int i = 0; i < 2; i ++) {
>     List categories = new LinkedList();
>     categories.add("01");
>     categories.add("02");
>     categories.add("03");
>     Query q = entityManager.createQuery("select v.id from Category v where v.id in (:p)
order by v.id asc");
>     q.setParameter("p", categories);
>     List results = q.getResultList();
>     for (Iterator it = results.iterator(); it.hasNext(); )
>          System.out.print(it.next() + ", ");
>     System.out.println();
> }
> The above code will produce the following output:
> 01, 02, 03,
> 02, 03,
> "01" is missing when the second time the same query is executed.

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


Mime
View raw message