-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Issue with HHH-2534- illegal 'collection dereference'?
PostPosted: Tue May 08, 2007 2:30 pm 
Newbie

Joined: Thu Sep 23, 2004 6:23 pm
Posts: 4
The HQL query below worked fine on Hibernate 3.2.0ga, 3.2.1ga, and 3.2.2ga and issued reasonable SQL. However, when upgrading to 3.2.3ga, it throws an exception (described below).

Here's a link to the relevant Jira issue:
http://opensource.atlassian.com/project ... e/HHH-2534

Looking at the release notes, according to Jira issue HHH-2534, it seems there were changes put in place which result in a "better exception message". However, I don't see why an exception should be thrown in this particular case, especially when the Hibernate version prior was capable of generating correct SQL for the query.

Hibernate version:
Upgrading from 3.2.0ga > 3.2.3ga with Hibernate Annotations 3.2.0ga to 3.2.1ga

Name and version of the database you are using:
Postgres 8.2.3 with jdbc driver 8.2-504

Full stack trace of any exception that occurs:
(Under Hibernate 3.2.3ga and Annotations 3.2.1ga:

org.hibernate.QueryException: illegal attempt to dereference collection [trace0_.id.hops] with element property reference [hopOrder] [
select count(distinct tr)
from Trace tr
join tr.hops hop
where
hop.hopOrder = (select max(tr.hops.hopOrder) from tr.hops)
and hop.responseip.cidrval=inet(:ipAddr)
and tr.sds.id in (:sdsList)
]

SQL Under Hibernate 3.2.2ga
Under Hibernate 3.2.2ga (I also get the same SQL and no exception under 3.2.1ga and 3.2.0ga) and Annotations 3.2.1ga (as well as Annotations 3.2.0ga) it works fine and generates the following sensible SQL:
Code:
    select
        count(distinct trace0_.id) as col_0_0_
    from
        scan.trace trace0_
    inner join
        scan.hop hops1_
            on trace0_.id=hops1_.trace_id,
        scan.cidrmap cidrmap4_
    where
        hops1_.responseip_id=cidrmap4_.id
        and hops1_.hopOrder=(
            select
                max(hops3_.hopOrder)
            from
                scan.hop hops2_,
                scan.hop hops3_
            where
                trace0_.id=hops2_.trace_id
                and trace0_.id=hops3_.trace_id
        )
        and cidrmap4_.cidrval=inet(?)
        and (
            trace0_.sds_id in (
                ?
            )
        )

(As a side note- yes I do realize that this causes hibernate to apply first/max results in memory)

Just wanted to post to the forum and see if this made sense to anyone else or if I'm missing something before posting to Jira. (Also- not sure if the preference would be to create a new issue or re-open the existing one...)

Thanks,
Bucky


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.