-->
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.  [ 3 posts ] 
Author Message
 Post subject: FETCH JOIN after upgrade to Hibernate-core 3.5.6-Final
PostPosted: Thu Apr 14, 2011 4:31 am 
Newbie

Joined: Thu Apr 14, 2011 4:11 am
Posts: 6
In our project we are trying to upgrade the hibernate version. During the upgrade we discovered failures of the form:

org.hibernate.QueryException:
query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=stea,role=null,tableName=STELLENANGEBOT,tableAlias=stellenang3_,origin=ASDATEN asdaten2_,columns={asdaten2_.LSTELLENID ,className=de.arbeitsagentur.vam.dom.fachentitaeten.Stellenangebot}}] [

<![CDATA[SELECT distinct asf
FROM Asfavorit asf
LEFT JOIN FETCH asf.asdaten
LEFT JOIN FETCH asf.asdaten.stellenangebot stea
LEFT JOIN FETCH stea.stellenlokation lok
LEFT JOIN FETCH stea.arbeitgeber ag
LEFT JOIN FETCH ag.kunde
WHERE asf.bewerber.id = :bewerberId
]]>

However, the query above worked fine for hibernate version 3.2.6.ga. Any suggestions?

P.S.: A similar topic was viewtopic.php?t=964901, but it did not really help for us.


Top
 Profile  
 
 Post subject: Re: FETCH JOIN after upgrade to Hibernate-core 3.5.6-Final
PostPosted: Thu Apr 14, 2011 5:36 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I am not sure, but it could help to assign an alias to the first join and use that alias in the second one (just as you do for the rest of the joins)

Code:
...
LEFT JOIN FETCH asf.asdaten asd
LEFT JOIN FETCH asd.stellenangebot stea
...


There were some changes related to how implicit joins are handled in the 3.5 release. See http://opensource.atlassian.com/project ... e/HHH-4091 for more information. I don't know if this applies in your case but it's worth a try.


Top
 Profile  
 
 Post subject: Re: FETCH JOIN after upgrade to Hibernate-core 3.5.6-Final
PostPosted: Thu Apr 14, 2011 5:42 am 
Newbie

Joined: Thu Apr 14, 2011 4:11 am
Posts: 6
Exactly!

We tried the exact same thing (with a tired and little motivation :) ) and it worked with the alias. Now we are to refactor all such queries.

Thanks for the quick reply though :)


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

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.