0

I create a query like this in JPA (EclipseLink)

Query selectQuery = ... and SUBSTR(FOO, 0, 1) IN (?1)

or

Query selectQuery = ... and SUBSTR(FOO, 0, 1) IN ?1

I set a parameter like this:

selectQuery.setParameter(1, Arrays.asList(new String[] { "T" }));

However it is telling me invalid column type

When I change my query to this:

Query selectQuery = ... and SUBSTR(FOO, 0, 1) IN ('T')

it works as expected.

Did I miss anything?

matthias
  • 1,938
  • 23
  • 51

2 Answers2

0

Duplicate. The answer, anyway, is to use SUBSTR(FOO, 0, 1) IN ?1 without the parantheses.

Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
0

You are passing a list as a parameter, thus you should use the setParameterList method:

selectQuery.setParameterList(1, Arrays.asList(new String[] { "T" })); 
Maciej Kowalski
  • 25,605
  • 12
  • 54
  • 63