Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: 5.2.10
    • Fix versions: 5.2.11
    • Components: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      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[].

      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:

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

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: