[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3038) HQL with subquery that contains join with CollectionOfElements generates SQL missing a table

Rodrigo Cesar Gevaerd de Faria (JIRA) noreply at atlassian.com
Fri Dec 28 17:23:05 EST 2007


HQL with subquery that contains join with CollectionOfElements generates SQL missing a table
--------------------------------------------------------------------------------------------

                 Key: HHH-3038
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3038
             Project: Hibernate3
          Issue Type: Bug
          Components: query-hql
    Affects Versions: 3.2.5
         Environment: hibernate core 3.2.5.GA, hibernate annotations 3.3.0.GA, MS SQL Server 2000
            Reporter: Rodrigo Cesar Gevaerd de Faria


The HQL
select v.id from ContentVersion v where	:si = any ( from v.publications p join p.serviceInstanceIds psi)

is generating the following invalid SQL:
select
  contentver0_.id as col_0_0_ 
 from
  lum_ContentVersion contentver0_ 
 where
  ?=any (
   select
    publicatio1_.id 
   from
    
   inner join
    lum_ContentPubServiceInst serviceins2_ 
     on publicatio1_.id=serviceins2_.contentPublicationId 
   where
    contentver0_.id=publicatio1_.contentVersionId
  )

Note that there is a table missing in the FROM in the subquery (the publicatio1_ table is missing just before the inner join clause). This always happens when I try to join with a @CollectionOfElements inside a subquery (in this case, it is the "serviceInstanceIds" attribute). If instead I join with another entity, the sql is generated correctly.

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