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

Gail Badner (JIRA) noreply at atlassian.com
Fri Apr 4 14:09:34 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29946 ] 

Gail Badner commented on HHH-3219:
----------------------------------

Please attach a runnable test case (Java + mapping) that reproduces the issue.

> 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