change to semantics of query with no 'select' list #4744
Replies: 5 comments 2 replies
-
The legacy behavior makes no sense.
|
Beta Was this translation helpful? Give feedback.
-
So in trying to figure out exactly what the semantics of this are, I tried the following two very similar-looking HQL queries:
And
Clearly these are the "same" query, written using a slightly different syntax. Now, in Hibernate 5, these two queries would have returned the same-shaped result list: a list of tuples of type But in Hibernate 6, the first query returns a List of I'm really struggling to see how the new behavior is better. In particular I don't see how it's the case that the legacy interpretation of the first query makes "no sense" whereas the legacy interpretation of the second query does make sense. |
Beta Was this translation helpful? Give feedback.
-
This is where we will disagree. They are not the same |
Beta Was this translation helpful? Give feedback.
-
Look, we simply disagree on this. I'll let others chime in. But I have no plans on reverting this |
Beta Was this translation helpful? Give feedback.
-
This issue was fixed before H6 went out. The resolution (suggested by @sebersole) was to use the result type to imply the |
Beta Was this translation helpful? Give feedback.
-
I just learned from the migration guide that the semantics of a queries like:
has changed.
I did not know this, and I don't know what the reasoning was.
Perhaps there's a great reason, but at first sight this seems like a pretty bad idea to me:
select
clause has always been interpreted as approximately something like a SQLselect *
, i.e. return me everything in thefrom
clause. This is something different. It returns me, what, only root entities in thefrom
clause? Only the first root entity? I'm not sure.So, what was behind this?
Beta Was this translation helpful? Give feedback.
All reactions