Criteria API multiselect not working with Predicates
Description
There is a problem with CriteriaQuery.multiselect(...) method. This method takes a list of Selection's as argument.
When list of Selection's is a list of Path's, everythink works as expected: cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"));
The problem occurs when to list of Selection's I added some Predicate's. For example: cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"), cb.isNotNull(r.get("col4"));
This code throws an "org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor" exception, but correct constructor exists. The same code works correctly with OpenJPA, ObjectDB and BatooJPA.
I have prepared a simple test project for Hibernate and other JPA implementations (attachment). To execute Hibernate test, call: mvn clean test -Phibernate
There is a problem with CriteriaQuery.multiselect(...) method. This method takes a list of Selection's as argument.
When list of Selection's is a list of Path's, everythink works as expected:
cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"));
The problem occurs when to list of Selection's I added some Predicate's. For example:
cq.multiselect(r.get("col1"), r.get("col2"), r.get("col3"), cb.isNotNull(r.get("col4"));
This code throws an "org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor" exception, but correct constructor exists. The same code works correctly with OpenJPA, ObjectDB and BatooJPA.
I have prepared a simple test project for Hibernate and other JPA implementations (attachment). To execute Hibernate test, call:
mvn clean test -Phibernate