[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-2451) HQL: selecting subselects within subselects doesn't work

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Feb 27 08:21:31 EST 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2451?page=all ]
     
Steve Ebersole closed HHH-2451:
-------------------------------

    Resolution: Rejected

And yet unlike HHH-2284, what you are trying here is explicitly disallowed.  It is not valid to "directly dereference" a collection.  You must instead use the explicit join syntax.

Why?  Because semantically it makes no sense.  A collection of 'criteriaLinks_' does not collectively have a 'documents_' attribute.  Nor for that matter does a collection of 'documents_' collectively have an 'id' attribute.

> HQL: selecting subselects within subselects doesn't work
> --------------------------------------------------------
>
>          Key: HHH-2451
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2451
>      Project: Hibernate3
>         Type: Bug

>   Components: core, query-hql
>     Versions: 3.2.2
>     Reporter: Jay Merrifield

>
>
> This is similar to the bug in HHH-2284. Instead this time I have the following HQL query: 
> select eb from EarlyBird as eb, Topic as t  where eb.id = t.criteriaLinks_.documents_.id and t = ?
> where Topic contains
> <set access="field" name="criteriaLinks_" table="TopicCriteria" lazy="true" inverse="true">
>       <key column="topicId" />
>       <many-to-many column="criteriaLinkId" class="org.illumen.oasdpa.CriteriaLink" />
> </set>
> and CriteriaLink contains
> <set access="field" name="documents_" table="CriteriaDocument" lazy="true" inverse="false">
>       <key column="criteriaLinkId"/>
>       <many-to-many column="documentId" class="org.illumen.document.Document"/>
> </set>
> This works under 3.0. But it's failing with the error: 
> 2007-02-26 17:27:02,775 DEBUG [DotNode] getDataType() : documents_ -> org.hibernate.type.IdentifierBagType(org.illumen.oasdpa.CriteriaLink.documents_)
>  org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:555)
> 2007-02-26 17:27:02,775 ERROR [PARSER]  illegal syntax near collection: documents_
>  org.hibernate.hql.ast.ErrorCounter.reportError(ErrorCounter.java:33)
> 2007-02-26 17:27:02,790 DEBUG [ErrorCounter]  illegal syntax near collection: documents_
>  org.hibernate.hql.ast.ErrorCounter.reportError(ErrorCounter.java:28)
>  illegal syntax near collection: documents_
> 	at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:500)
> 	at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:205)
> 	at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:143)
> 	at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:460)

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