-->
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: Loading collection issues
PostPosted: Sat May 10, 2008 9:22 am 
Beginner
Beginner

Joined: Thu Oct 25, 2007 3:45 am
Posts: 22
Hi,

A list of objects of type Class1 with a <bag> collection of type Class2 need to be loaded. The mappings are:

Class1:

<bag name="Class2Property"
table="Class2"
cascade="all-delete-orphan"
inverse="false"
lazy="false"
fetch="join">
<key column="Class1Id" />
<one-to-many class="Class2"/>
</bag>

Class2: not important.

Whats the case:
- if fetch="join" is not set (default select) NHibernate generates too many select queries (I think it is so called "N + 1 problem").
- if fetch="join" is set, equal objects of the collection are selected (the same object is included in the collection more than once, because of some outer join).

So, how to tell NHibernate not to include the same object more than once in the collection?


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.