[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3219) HQL query with IN using inner query generates invalid SQL for MySQL

Luís Fernando Arcaro (JIRA) noreply at atlassian.com
Fri Apr 4 13:58:32 EDT 2008


HQL query with IN using inner query generates invalid SQL for MySQL
-------------------------------------------------------------------

                 Key: HHH-3219
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3219
             Project: Hibernate3
          Issue Type: Bug
    Affects Versions: 3.2.6
         Environment: Hibernate 3.2.5GA, Hibernate 3.2.6GA, MySQL 5.0.18
            Reporter: Luís Fernando Arcaro


For MySQL, the following HQL query:

SELECT cnFont.cdFont AS cdFont,
	cnFont.nmFont AS nmFont,
	(
		CASE WHEN cnFont IN (
			SELECT cnPanel.cnPanelFont
			FROM CnPanel cnPanel
			WHERE cnPanel.cdPanel = :cdPanel
		) THEN 1 ELSE 0 END
	) AS fgAssociated
FROM CnFont cnFont

Generates the (invalid) following SQL:

select cnfont0_.cdFont as col_0_0_, cnfont0_.nmFont as col_1_0_, case when cnfont0_.cdFont in (select . from cnPanel cnpanel1_, cnPanelFont cnpanelfon2_, cnFont cnfont3_ where cnpanel1_.cdPanel=cnpanelfon2_.cdPanel and cnpanelfon2_.cdFont=cnfont3_.cdFont and cnpanel1_.cdPanel=?) then 1 else 0 end as col_2_0_ from cnFont cnfont0_

See "...select . from.." in the inner query: should be "...select cnfont3_.cdFont from..."?

-- 
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

       




More information about the hibernate-issues mailing list