-->
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.  [ 6 posts ] 
Author Message
 Post subject: Lazy load not working
PostPosted: Wed May 18, 2005 4:08 pm 
Hi all,

I am having some pretty severe problems with lazy loading. Basically, none of my collections are being loaded lazily when speciified. Several of my classes have several collections. Here is an example of my mappings, other association mappings in the classes are omitted for clarity:

The 'one-to-many' class:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
<class name="Case,Api" table="Case">
      <id name="caseID" column="caseID" type="Int32" unsaved-value="0">
         <generator class="native" />
      </id>
<set name="issues" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="caseID" />
<one-to-many class="Issue, Api" />
</set>
</hibernate-mapping>



The many-to-one class:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-access="field">
   <class name="Issue,Api" table="Issue">
      <id name="caseIssueID" column="caseIssueID" type="Int32" unsaved-value="0">
         <generator class="native"/>
      </id>
      <many-to-one name="Case" column="caseID" class="Case,Api" />
</hibernate-mapping>



This is how I map most of my collections. As I said, none of them are being lazy loaded. Any help would be much appreciated as I wil be running into performance issues if I can't get this fixed. I am using version 0.8.2. Outer join fetching is set to false in my web.config file as default.

Many thanks,
Tony


Top
  
 
 Post subject:
PostPosted: Wed May 18, 2005 5:15 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
It would help a lot if you could configure log4net to log at least at INFO or DEBUG level, and post the relevant parts of the log here. Your mappings look right at a glance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 10:50 am 
Newbie

Joined: Thu May 19, 2005 10:04 am
Posts: 2
Location: Glasgow, Scotland
Hi Sergey,

Which parts of the mapping file in particular? The SELECT statements for the Case and its many associated collections go on for a considerable number of lines in the log. Should I be using 'proxy' on the target class perhaps?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 11:02 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Post informations about the test you run to see if lazy-loading works (C# files and the content of your log file).

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 19, 2005 12:32 pm 
Guys, thanks for the replies but I've just realised that I don't have a problem after all. I'd checked the variables in the debugger while the session was still open, hence I came to the conclusion that the collections were not being loaded lazily. When I came to my senses and checked the returned object in the presentation tier through the debugger, I get the exceptions I expect. The reason I hadn't noticed this earlier is that my app isn't set to attempt to load any of the lazy collections yet! I blame three weeks without a day off and working 14 hours per day! And no, I don't work for EA before anybody asks!! :wink:


Top
  
 
 Post subject:
PostPosted: Thu May 19, 2005 12:45 pm 
Newbie

Joined: Thu May 19, 2005 10:04 am
Posts: 2
Location: Glasgow, Scotland
Anonymous wrote:
Guys, thanks for the replies but I've just realised that I don't have a problem after all. I'd checked the variables in the debugger while the session was still open, hence I came to the conclusion that the collections were not being loaded lazily. When I came to my senses and checked the returned object in the presentation tier through the debugger, I get the exceptions I expect. The reason I hadn't noticed this earlier is that my app isn't set to attempt to load any of the lazy collections yet! I blame three weeks without a day off and working 14 hours per day! And no, I don't work for EA before anybody asks!! :wink:


Sorry, hadn't logged in there. Thanks again, I definitely need more sleep.... :shock:


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