Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: for the plan.

Jump to: navigation, search


< EclipseLink‎ | Examples‎ | JPA‎ | Migration‎ | OpenJPA

JPQL Differences

IN collection valued input parameter syntax

OpenJPA supported an extra set of parenthesis around IN parameters when the parameter is a collection type (ie: List, Set, etc). This is not spec compliant and EclipseLink does not support this syntax.

Take the following example JPQL. (Note that this query works with OpenJPA.)

SELECT p FROM Person p WHERE IN (:ids)

When using EclipseLink, calling 'Query.setParameter("ids", list)' with a Collection object will result in the following exception:

java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ArrayList for parameter ids with expected type of int from query string SELECT p FROM Person p WHERE IN (:ids).

Solution: Remove the extra parenthesis from the JPQL statement. This will result in the following query:

SELECT p FROM Person p WHERE IN :ids

Back to the top