-->
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: collection loading
PostPosted: Thu Nov 03, 2005 7:12 am 
Newbie

Joined: Thu Jun 02, 2005 6:00 am
Posts: 12
Location: Ostrava, Czech Republic
Hi, I have a question about collection loading strategy. I am using Criteria like this:
Code:
   ICriteria crit = session.CreateCriteria(typ);
... some code here...
   list = crit.List();


As I look at MSSQL profiller trace, I see that after executing first query with outer joined objects, it does a a query again for each of the object in the collection (by primary key). When the collection is big, this scenario is quite performance killing.
First I thought that setting all joined objects to outer join and all collections in the main object to lazy solves this problem, but not.
I tried to search this forum for simillar question but I didn't find any. Does anybody have a tip how to disable such behavior?

the mapping document looks like this:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="CID.BusinessObjekty.StavZasob, SkladLib" table="STAV_ZASOB">
      <id name="Id" column="lIDStavZbozi" unsaved-value="0">
         <generator class="native" />
      </id>
      
      <property name="Cislo" column="szCislo"/>
      <property name="Zkratka" column="szZkratka"/>
      <property name="PocetKusu" column="fKus"/>      
      
      <many-to-one name="Zbozi" outer-join="true" column="IDZbozi" property-ref="IdIS" cascade="none" class="CID.BusinessObjekty.SkladoveZbozi, SkladLib" />               
      <many-to-one name="Exportovano" outer-join="true" column="IDExport" class="CID.BusinessObjekty.Export, SkladLib" />
      <many-to-one name="Zakaznik" outer-join="true" column="IDZakaznik" cascade="none" class="CID.BusinessObjekty.Spolecnost, UserLib" />               
      
   </class>
   
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 11:58 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
In your mapping, there is no collection to set as lazy!

You may either set the associations (many-to-one) as lazy or their collections.

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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.