-->
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: SQL Generation for Multiple Set Mappings
PostPosted: Fri Dec 10, 2004 8:15 pm 
Beginner
Beginner

Joined: Mon Nov 22, 2004 8:53 pm
Posts: 23
I have a simple class mapping that has two one-to-many sets in it. Both sets have outer-join set to true. The sql that hibernate generates is single query for the base table and first set table and then an individual sql statement for the second set’s table. If I reverse the order of the sets in the mapping file, it reverses what table it joins in and which one it individually selects.

Is there any way to get it to put both joins in at the same time and execute only one query? I can by writing manual sql and it improves performance by more then 200%.

Thanks.
-peter

Mapping documents:

<class name="foo" table="foo" mutable="false" batch-size="50" optimistic-lock="none" lazy="false">

<id name="id" column="foo_id" type="integer">
<generator class="assigned"/>
</id>

<set name="bars" cascade="none" lazy="false" outer-join="true">
<key column="bar_id"/>
<one-to-many class="bar"/>
</set>

<set name="teas" cascade="none" lazy="false" outer-join="true">
<key column="tea_id"/>
<one-to-many class="tea"/>
</set>

…many other fields and a many-to-one mappings omitted…

</class>

<class name="bar" table="bar" mutable="false">

<id name="id" column="bar_id" type="integer">
<generator class="assigned"/>
</id>

..a couple simple fields omitted…
</class>

<class name="tea" table="tea " mutable="false">

<id name="id" column="tea_id" type="integer">
<generator class="assigned"/>
</id>

..a couple simple fields omitted…

</class>

Hibernate version:
2.1.7

Name and version of the database you are using:
Oracle9i


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.