From: <leg...@at...> - 2004-01-02 08:15:25
|
The following comment has been added to this issue: Author: simon xi Created: Fri, 2 Jan 2004 2:14 AM Body: For the error message I write in the description, (***message3_.toc as toc2_,******having (message3_.toc=max(message3_.toc)) should be (***message3_.toc******having (message3_.toc=max(message3_.toc)) NOTICE: (***message3_.toc as toc2_******having(toc2_=max(toc2_))) doesn't work It means if some attribute in the having clause, it should not generate the alias for it. Or it will fail at least against MySQL database --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-593 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-593 Summary: Having clause couldn't get the alias in it Type: Bug Status: Unassigned Priority: Critical Project: Hibernate2 Components: core Versions: 2.1 Assignee: Reporter: simon xi Created: Thu, 1 Jan 2004 6:43 PM Updated: Fri, 2 Jan 2004 2:14 AM Environment: mysql database Description: The hibernate generate the attribute of field, but in Having clause, it use the true field name, so the database will say that there is no this field in database. warning : SQL Error: 1054, SQLState: S0022 2004-1-2 8:37:20 net.sf.hibernate.util.JDBCExceptionReporter logExceptions Hibernate: select forum0_.id as id0_, category1_.id as id1_, message3_.id as id2_, forum0_.name as name0_, forum0_.priority as priority0_, category1_.name as name1_, category1_.priority as priority1_, category1_.description as descript4_1_, category1_.moderator as moderator1_, category1_.forum as forum1_, message3_.toc as toc2_, message3_.text as text2_, message3_.poster as poster2_, message3_.topic as topic2_, message3_.parent as parent2_, forum0_.id as x0_0_, category1_.id as x1_0_, count(distinct topic2_.id) as x2_0_, count(distinct message3_.id) as x3_0_, message3_.id as x4_0_ from Forum forum0_, Category category1_, Topic topic2_, Message message3_ where (message3_.topic=topic2_.id )and(topic2_.category=category1_.id )and(category1_.forum=forum0_.id ) group by topic2_.category , category1_.forum having (message3_.toc=max(message3_.toc)) order by forum0_.priority desc , category1_.priority desc , topic2_.toc desc fatal: Column not found, message from server: "Unknown column 'message3_.toc' in 'having clause'" 2004-1-2 8:37:20 net.sf.hibernate.JDBCException <init> fatal: Could not execute query java.sql.SQLException: Column not found, message from server: "Unknown column 'message3_.toc' in 'having clause'" --------------------------------------------------------------------- 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 |