openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Gierke (JIRA)" <>
Subject [jira] [Created] (OPENJPA-2018) Cannot bind String[] to ParameterExpression for
Date Wed, 15 Jun 2011 17:09:48 GMT
Cannot bind String[] to ParameterExpression for

                 Key: OPENJPA-2018
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
    Affects Versions: 2.1.0
            Reporter: Oliver Gierke

Given the following code:
User user = new User("Dave", "Matthews", "");

CriteriaBuilder builder = em.getCriteriaBuilder();

CriteriaQuery<User> criteria = builder.createQuery(User.class);
Root<User> root = criteria.from(User.class);

TypedQuery<User> query = em.createQuery(criteria);
for (ParameterExpression parameter : criteria.getParameters()) {
  query.setParameter(parameter, new String[] {"Dave", "Carter"});

List<User> result = query.getResultList();
assertThat(result.isEmpty(), is(false));

I get a

<openjpa-2.0.0-r422266:935683 nonfatal user error> org.apache.openjpa.persistence.ArgumentException:
The specified parameter of type "class [Ljava.lang.String;" is not a valid query parameter.

Using {{Collection}} as {{ParameterExpression}} type and binding the parameters via {{Arrays.asList(...)}}
works fine.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message