We're updating the issue view to help you get more done. 

Reusing Query but changing collection parameters returns wrong result

Description

Reusing a query by reinitializing a parameter (which contains a collection of values) returns a wrong result. The number of elements is correct in the result but the result is not deterministic. The second execution contains elements of the first result.
E.g.

  • query.setParameter("id", Arrays.asList("1", "2", "3"); query.getResultList(); // returns 1, 2, 3

  • query.setParameter("id", Arrays.asList("4", "5", "6"); query.getResultList(); // reusing the same query doesn't return 4, 5, 6 but a random result with 3 objects, e.g. 1, 4, 6

Sample code attached.

Environment

None

Status

Assignee

Andrea Boriero

Reporter

F. Martin

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.0

Priority

Critical