-->
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: Unnecessary join generated from HQL - Bug?
PostPosted: Fri May 17, 2013 10:43 am 
Newbie

Joined: Fri May 17, 2013 10:28 am
Posts: 1
To all the Hibernate developers and other gurus out there ...

There seems to be a bug (Hibernate 3.6.10) that generates a totally unnecessary join from an HQL query:

Code:
/* select
        new GroupSummary(
         count(theWebTestSessionQuestion.testSession),
         theWebTestSessionQuestion.group,
         sum(theWebTestSessionQuestion.pact),
         sum(theWebTestSessionQuestion.pmax))
    from
        WebTestSessionQuestion theWebTestSessionQuestion
    group by
        theWebTestSessionQuestion.group */ select
            count(webtestses0_.WQSQ_WQSID) as col_0_0_,
            webtestses0_.WQSQ_GROUP as col_1_0_,
            sum(webtestses0_.WQSQ_PACT) as col_2_0_,
            sum(webtestses0_.WQSQ_PMAX) as col_3_0_
        from
            WWW_QTSQ webtestses0_,
            WWW_QTS webtestses1_
        where
            webtestses0_.WQSQ_WQSID=webtestses1_.WQS_LFDNR
        group by
            webtestses0_.WQSQ_GROUP


The Criteria API does get it right, though, and produces the simple SQL I expect:

Code:
/* criteria query */ select
        count(this_.WQSQ_WQSID) as y0_,
        this_.WQSQ_GROUP as y1_,
        sum(this_.WQSQ_PACT) as y2_,
        sum(this_.WQSQ_PMAX) as y3_,
        this_.WQSQ_GROUP as y4_
    from
        WWW_QTSQ this_
    group by
        this_.WQSQ_GROUP


Any suggestions or comments? Do I have to alter the HQL in some way or other?


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.