Hi,
I am encountering the same problem and do not know how to fix it. If my relation is one sided, the query takes only a quarter of a second but when using a bidirectional association, it takes more than 10 seconds (on a heavy loaded database).
Here are my mappings:
Code:
<set
name="providers"
table="PRODUCTS2PROVIDERS"
lazy="false"
cascade="none"
sort="org.mdarad.samples.totaltest.entities.ProviderComparator"
outer-join="true">
<key
column="PRODUCTS_FK"
>
</key>
<many-to-many
class="org.mdarad.samples.totaltest.entities.Provider"
column="PROVIDERS_FK"
outer-join="true"
/>
</set>
Code:
<set
name="products"
table="PRODUCTS2PROVIDERS"
lazy="false"
cascade="none"
sort="org.mdarad.samples.totaltest.entities.ProductComparator"
outer-join="true"
inverse="true">
<key
column="PROVIDERS_FK"
>
</key>
<many-to-many
class="org.mdarad.samples.totaltest.entities.Product"
column="PRODUCTS_FK"
outer-join="true"
/>
</set>
I have tried to add to the provider "set" the fetch=select or fetch=subselect but do not get the expected results. The select takes even more time and the subselect doesn't change anything.
Any idea how I can fix this to have my eager fetch not end up as a cartesian join for my bidirectional many-to-many association?
Thanks,
Francois[/code]