Skip to:
I think it’s related to https://hibernate.atlassian.net/browse/HHH-17223 but in this case it occurs when using subquery:
JpaCriteriaQuery<Integer> query = cb.createQuery(Integer.class); JpaSubQuery<Tuple> subquery = query.subquery(Tuple.class); JpaRoot<Primary> sqRoot = subquery.from(Primary.class); subquery.multiselect( sqRoot.get("id").alias("id"), sqRoot.get("capacity").alias("capacity") ); JpaDerivedRoot<Tuple> root = query.from(subquery); query.select( cb.sum(root.get("capacity")) ); Integer result = entityManager.createQuery(query).getSingleResult();
and the exception is:
java.lang.ClassCastException: class org.hibernate.query.derived.AnonymousTupleSqmPathSource cannot be cast to class org.hibernate.query.ReturnableType
If this case was also fixed in https://hibernate.atlassian.net/browse/HHH-17223 the please close this issue.
I think it’s related to https://hibernate.atlassian.net/browse/HHH-17223 but in this case it occurs when using subquery:
JpaCriteriaQuery<Integer> query = cb.createQuery(Integer.class); JpaSubQuery<Tuple> subquery = query.subquery(Tuple.class); JpaRoot<Primary> sqRoot = subquery.from(Primary.class); subquery.multiselect( sqRoot.get("id").alias("id"), sqRoot.get("capacity").alias("capacity") ); JpaDerivedRoot<Tuple> root = query.from(subquery); query.select( cb.sum(root.get("capacity")) ); Integer result = entityManager.createQuery(query).getSingleResult();
and the exception is:
java.lang.ClassCastException: class org.hibernate.query.derived.AnonymousTupleSqmPathSource cannot be cast to class org.hibernate.query.ReturnableType
If this case was also fixed in https://hibernate.atlassian.net/browse/HHH-17223 the please close this issue.