From: <no...@at...> - 2005-08-21 01:26:59
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-892 Summary: HQL parser does not resolve alias in ORDER BY clause Type: Bug Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Versions: 3.0.5 Assignee: Reporter: Guido Laures Created: Sat, 20 Aug 2005 8:26 PM Updated: Sat, 20 Aug 2005 8:26 PM Environment: Hibernate 3.0.5, MySQL, Tomcat Description: When using an alias for an ORDER BY clause this is not always correctly resolved. Example: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. Workaround (not to say "hack") is using: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <no...@at...> - 2005-08-21 02:50:57
|
The following issue has been updated: Updater: Gavin King (mailto:ga...@hi...) Date: Sat, 20 Aug 2005 9:50 PM Changes: priority changed from Major to Minor --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-892 Summary: HQL parser does not resolve alias in ORDER BY clause Type: New Feature Status: Unassigned Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Versions: 3.0.5 Assignee: Reporter: Guido Laures Created: Sat, 20 Aug 2005 8:26 PM Updated: Sat, 20 Aug 2005 9:50 PM Environment: Hibernate 3.0.5, MySQL, Tomcat Description: When using an alias for an ORDER BY clause this is not always correctly resolved. Example: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. Workaround (not to say "hack") is using: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: <no...@at...> - 2005-08-21 02:50:57
|
The following issue has been updated: Updater: Gavin King (mailto:ga...@hi...) Date: Sat, 20 Aug 2005 9:49 PM Comment: Correct, and this is not a bug. Changes: type changed from Bug to New Feature --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-892 Summary: HQL parser does not resolve alias in ORDER BY clause Type: New Feature Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Versions: 3.0.5 Assignee: Reporter: Guido Laures Created: Sat, 20 Aug 2005 8:26 PM Updated: Sat, 20 Aug 2005 9:49 PM Environment: Hibernate 3.0.5, MySQL, Tomcat Description: When using an alias for an ORDER BY clause this is not always correctly resolved. Example: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. Workaround (not to say "hack") is using: SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
From: Jere K. (JIRA) <no...@at...> - 2005-08-29 19:38:57
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=comments#action_19636 ] Jere Krischel commented on HHH-892: ----------------------------------- when you use the workaround, will it work the same in all environments? I'm worried that my "order by LASTNAME2_" will break on a different hibernate.cfg.xml file. Will Hibernate always generate the same SQL aliases, or will that be dialect dependent? works: .createQuery("from "+voType+" where upper(lastName) like upper(:startsWith) and role in (:roles) order by LASTNAME2_ asc") doesn't work: .createQuery("from "+voType+" where upper(lastName) like upper(:startsWith) and role in (:roles) order by lastName asc") generated sql: Hibernate: select adminuserv0_.ID as ID, adminuserv0_.LOGIN as LOGIN2_, adminuserv0_.LASTNAME as LASTNAME2_, adminuserv0_.FIRSTNAME as FIRSTNAME2_, adminuserv0_.MIDDLENAME as MIDDLENAME2_, adminuserv0_.EMAIL as EMAIL2_, adminuserv0_.STATUS as STATUS2_, adminuserv0_.PASSEXPIRATION as PASSEXPI8_2_, adminuserv0_.FAILEDATTEMPTS as FAILEDAT9_2_, adminuserv0_.CURRENTPASSWORD as CURRENT10_2_, adminuserv0_.CURRENTPWDSALT as CURRENT11_2_, adminuserv0_.CREATEDATE as CREATEDATE2_, adminuserv0_.CREATEDBY as CREATEDBY2_, adminuserv0_.PWDCHANGEDATE as PWDCHAN14_2_, adminuserv0_.PWDCHANGEDBY as PWDCHAN15_2_, adminuserv0_.ACCEPTEDTACDATE as ACCEPTE16_2_, adminuserv0_.PASSWORD as PASSWORD2_, adminuserv0_.ROLE as ROLE2_, adminuserv0_.JSESSIONID as JSESSIONID2_ from SBB.BROKER_ADMIN adminuserv0_ where (upper(adminuserv0_.LASTNAME)like upper(?)) and (adminuserv0_.ROLE in (? , ?)) order by LASTNAME2_ asc > HQL parser does not resolve alias in ORDER BY clause > ----------------------------------------------------- > > Key: HHH-892 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 > Project: Hibernate3 > Type: New Feature > Versions: 3.0.5 > Environment: Hibernate 3.0.5, MySQL, Tomcat > Reporter: Guido Laures > Priority: Minor > > > When using an alias for an ORDER BY clause this is not always correctly resolved. Example: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum > does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. > Workaround (not to say "hack") is using: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Armin H. (JIRA) <no...@at...> - 2005-11-15 01:16:16
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=comments#action_20712 ] Armin Haaf commented on HHH-892: -------------------------------- I think this is inconsistent behaviour and therefore a bug. It is possible to alias a "standard" select column, but it is not possible to a alias a aggregate column. But there is another workaround, which should work on all environments: SELECT SUM(A.x) FROM MyClass AS A GROUP BY A.y ORDER BY SUM(A.x) This workaround may be performance relevant, because not every database is optimizing this. > HQL parser does not resolve alias in ORDER BY clause > ----------------------------------------------------- > > Key: HHH-892 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 > Project: Hibernate3 > Type: New Feature > Versions: 3.0.5 > Environment: Hibernate 3.0.5, MySQL, Tomcat > Reporter: Guido Laures > Priority: Minor > > > When using an alias for an ORDER BY clause this is not always correctly resolved. Example: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum > does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. > Workaround (not to say "hack") is using: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Aleksei V. (JIRA) <no...@at...> - 2006-04-03 17:47:28
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=comments#action_22688 ] Aleksei Valikov commented on HHH-892: ------------------------------------- If not a bug then "really nice to have". In Criteria API, you can order by the aliased column. In HQL not. ps. Probably another story to "patch it yourself". > HQL parser does not resolve alias in ORDER BY clause > ----------------------------------------------------- > > Key: HHH-892 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 > Project: Hibernate3 > Type: New Feature > Versions: 3.0.5 > Environment: Hibernate 3.0.5, MySQL, Tomcat > Reporter: Guido Laures > Priority: Minor > > > When using an alias for an ORDER BY clause this is not always correctly resolved. Example: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum > does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. > Workaround (not to say "hack") is using: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: igor s. (JIRA) <no...@at...> - 2006-06-14 12:30:50
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=comments#action_23335 ] igor spasic commented on HHH-892: --------------------------------- Is there any HQL-solution on this subject? I do not care if someone thinks this is not a bug - i need a HQL solution, instead. Or, at the end, any reasonable solution... > HQL parser does not resolve alias in ORDER BY clause > ----------------------------------------------------- > > Key: HHH-892 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892 > Project: Hibernate3 > Type: New Feature > Versions: 3.0.5 > Environment: Hibernate 3.0.5, MySQL, Tomcat > Reporter: Guido Laures > Priority: Minor > > > When using an alias for an ORDER BY clause this is not always correctly resolved. Example: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum > does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column. > Workaround (not to say "hack") is using: > SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_ -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |