Hello,
I am trying to do the following query:
Code:
query = aManager.createQuery("from Group g where g.id in (:aGroupIDList)");
query.setParameter("groupIdList", aGroupIDList);
when I test this code by passing in the following ArrayList
Code:
List groupIdArray = new ArrayList();
groupIdArray.add(0);
groupIdArray.add(1);
groupIdArray.add(2);
groupIdArray.add(3);
groupIdArray.add(4);
I get the following error:
Caused by: java.sql.SQLException: Wrong data type: For input string:
Code:
"[B@8cca2a"
at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.setParameter(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.setBytes(Unknown Source)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setBytes(WrappedPreparedStatement.java:424)
at org.hibernate.type.BinaryType.set(BinaryType.java:29)
at org.hibernate.type.SerializableType.set(SerializableType.java:29)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
at org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.java:236)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1105)
at org.hibernate.loader.Loader.doQuery(Loader.java:365)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:206)
at org.hibernate.loader.Loader.doList(Loader.java:1515)
Additional Info:
Group.id is an int value
If I hard code the values as follows the code works as expected:
Code:
query = aManager.createQuery("from Group g where g.id in (1,2,3)");
My question then is the following: how do I parametrically pass in to the query the values for the "in" operator?
Code: