-->
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.  [ 2 posts ] 
Author Message
 Post subject: subselect fetch for many-to-many
PostPosted: Fri Jan 19, 2007 11:37 am 
Newbie

Joined: Fri Jan 19, 2007 11:29 am
Posts: 2
Location: Russia
I have such mapping:

<subclass entity-name="StructuralConstraint" ...
...
<bag name="typeReferences" fetch="subselect" lazy="true" cascade="merge,persist,save-update,lock,refresh" table="structuralconstraint_placementtype">
<key/>
<many-to-many entity-name="PlacementType" unique="false"/>
</bag>
...
</subclass>

but when I have loaded some StructuralConstraints and try to get typeReferences for all of them I see that there are many queries:

Hibernate: select typerefere0_.id as id3_, typerefere0_.elt as elt3_, placementt1_.`id` as id1_50_0_, placementt1_.e_version as e3_50_0_, placementt1_.`name` as name4_50_0_, placementt1_.`base_id` as base5_50_0_, placementt1_.`abstract` as abstract6_50_0_, placementt1_.`reportingattribute_id` as reportin7_50_0_, placementt1_.`modified` as modified8_50_0_, placementt2_.`id` as id1_50_1_, placementt2_.e_version as e3_50_1_, placementt2_.`name` as name4_50_1_, placementt2_.`base_id` as base5_50_1_, placementt2_.`abstract` as abstract6_50_1_, placementt2_.`reportingattribute_id` as reportin7_50_1_, placementt2_.`modified` as modified8_50_1_, reportinga3_.`id` as id1_70_2_, reportinga3_.e_version as e3_70_2_, reportinga3_.`name` as name4_70_2_, reportinga3_.`value` as value5_70_2_, reportinga3_.`modified` as modified6_70_2_
from structuralconstraint_placementtype typerefere0_ left outer join `placementtype` placementt1_ on typerefere0_.elt=placementt1_.`id` left outer join `placementtype` placementt2_ on placementt1_.`base_id`=placementt2_.`id` left outer join `reportingattribute` reportinga3_ on placementt2_.`reportingattribute_id`=reportinga3_.`id` where typerefere0_.id=?

But there must be only one query for this association cause it is subselect fetching and I loose time.

Can anybody help?

Thanks


Top
 Profile  
 
 Post subject: Re: subselect fetch for many-to-many
PostPosted: Tue Jul 20, 2010 5:47 am 
Newbie

Joined: Tue Mar 09, 2010 11:30 am
Posts: 7
Hi there, did you manage to resolve this?
I am getting the same thing and its driving me nuts....


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.