| I tested it a little bit and read the JPA spec and there is no indication that we should imply any alias unless the user explicitly provides one. For instance, what if we change the query to this:
SELECT substring( firstName, 1, 2 ) from User
What would be the alias for the Tuple? According to this issue, we should use the substring( firstName, 1, 2 ) which is not very practical in my opinion. In this case, the user must specify the alias, and it will work no matter we have this query:
SELECT firstName as firstName from User
or this one:
SELECT substring( firstName, 1, 2 ) as firstName from User
If the JPA spec says the otherwise and I didn't notice it, let's reopen the issue and try to figure out all corner cases. |