Bug in CriteriaBuilder.in(Collection): IllegalArgumentException
---------------------------------------------------------------
Key: HHH-5099
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5099
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Final
Environment: hibernate 3.5, oracle 10g
Reporter: Max Hartmann
Method CriteriaBuilder.in(Collection<?> values) throws an IllegalArgumentException.
It's a wonder, but when I call CriteriaBuilder.in(Object... values) no Exception is
thrown.
Exception:
Exception in thread "main" java.lang.IllegalArgumentException: Parameter value
[1] was not matching type [java.util.Arrays$ArrayList]
at
org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:340)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:354)
at
org.hibernate.ejb.criteria.expression.LiteralExpression$1.bind(LiteralExpression.java:84)
at
org.hibernate.ejb.criteria.CriteriaQueryCompiler.compile(CriteriaQueryCompiler.java:174)
at
org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:432)
at test.server.TestApp.main(TestApp.java:29)
Code:
EntityManagerFactory factory = Persistence
.createEntityManagerFactory("userDatabase");
EntityManager em = factory.createEntityManager();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> createQuery = cb.createQuery(String.class);
Root<TestBean> from = createQuery.from(TestBean.class);
createQuery.select(cb.function("TO_CHAR", String.class, from
.get(TestBean_.date1))).where(from
.get(TestBean_.id).in(Arrays.asList(new String[] {"1", "2"})));
List<String> resultList = em.createQuery(createQuery).getResultList();
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira