[
https://issues.apache.org/jira/browse/OPENJPA-2618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15029975#comment-15029975
]
Oliver Gierke edited comment on OPENJPA-2618 at 11/27/15 3:24 PM:
------------------------------------------------------------------
I don't think it's about whether the spec allows this. I think it's weird to
accept a type in the first place and the later blow up not being able to handle
it. You could either be a strict denier and reject the query creation right
away or be kind and just implement support for that. While I certainly prefer
the latter, I'd also be fine with the former, as then I could handle the
explicit exception and find my way around the lack of support for this.
was (Author: oliver.gierke):
In this, it's not so much about whether the spec allows this. I think it's
weird to accept a type in the first place and the later blow up not being able
to handle it. You could either be a strict denier and reject the query creation
right away or be kind and just implement support for that. While I certainly
prefer the latter, I'd also be fine with the former, as then I could handle the
explicit exception and find my way around the lack of support for this.
> Query for Tuple does not return Tuple instance
> ----------------------------------------------
>
> Key: OPENJPA-2618
> URL: https://issues.apache.org/jira/browse/OPENJPA-2618
> Project: OpenJPA
> Issue Type: Bug
> Components: jpa
> Affects Versions: 2.4.0
> Reporter: Oliver Gierke
>
> {code:java}
> TypedQuery<Tuple> query = em.createQuery("SELECT u.firstname from User u",
> Tuple.class);
> List<Tuple> result = query.getResultList();
> List<TupleElement<?>> elements = result.get(0).getElements();
> {code}
> This breaks at {{result.get(0)}} with {{java.lang.ClassCastException:
> java.lang.String cannot be cast to javax.persistence.Tuple}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)