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

Query.stream() generic element type is wrong

Description

Query<R>.stream claims to return java.util.stream.Stream<R> but seems to always return a stream of Object[], even for queries with single entity results (i.e. created with createQuery("SELECT e FROM EntityType e", EntityType.class) that do have a Query<EntityType> type - and where the other typed methods getResultList/iterate produce the expected results.

Using that stream usually results in a ClassCastException:

1 2 3 q.stream().forEach(x -> { // we won't even get here as the argument is inferred as EntityType });

Environment

None

Status

Assignee

Chris Cranford

Reporter

Moritz Bechler

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.0

Priority

Major