We're updating the issue view to help you get more done. 

Query.stream() does not map Tuple

Description

When a CriteriaQuery<Tuple> has a multiple selection such as query.multiselect(sel1, sel2), one would expect the resulting session.createQuery(query).stream() to be a Stream<Tuple>, but its elements are Object[].

1 2 3 4 5 6 7 8 CriteriaQuery<Tuple> criteriaQuery = criteriaBuilder.createQuery(Tuple.class); Root<SampleEntity> from = criteriaQuery.from(SampleEntity.class); Path<Double> path = from.get("foo"); criteriaQuery.multiselect(criteriaBuilder.sum(path), criteriBuilder.avg(path)); Query<Tuple> query = session.createQuery(criteriaQuery); Stream<Tuple> stream = query.stream(); Tuple tuple = stream.findAny().get();

This will throw:

1 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to javax.persistence.Tuple

Environment

None

Status

Assignee

Chris Cranford

Reporter

Giovanni Lovato

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.10

Priority

Major