-->
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: many-to-one,one-to-one lazy loading
PostPosted: Thu Oct 27, 2005 4:00 pm 
Newbie

Joined: Thu Sep 08, 2005 12:15 pm
Posts: 17
Hi guys

I have an object with many-to-one relation to other objects. In my web apps I display a list of items . But only few member of the object, need to be display. Like the name the email etc.

The problem that I have is that my apps is not performant. After reading trought the log I think that the cause of the problem is that all the object are load and then it resolves all the relation that are man-to-one.

So my question is how can I load the properties only when i need them. Likje the lazyload for the collections ( ah btw my collections are lazy load so at least thay are not load with all other relations...)


any ideas?


here is a part of the log

[code]

2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - returning '452' as column: IdService
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Loader.Loader [(null)] <(null)> - result row: 452
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Loader.Loader [(null)] <(null)> - Initializing object from DataReader: 452
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Loader.Loader [(null)] <(null)> - Hydrating entity: Datablitz.Engine.objets.ServiceEmissionRadio#452
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - returning null as column: HeureDebut
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - returning null as column: SiteWeb
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - returning '10' as column: IdMedia
2005-10-27 15:40:01,872 [2456] DEBUG NHibernate.Type.NullableType [(null)] <(null)> - returning 'Diff


Last edited by SimonH on Thu Oct 27, 2005 6:23 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 5:48 pm 
Newbie

Joined: Thu Sep 08, 2005 12:15 pm
Posts: 17
Ok I found this article. It talk exactly about the problem that I have. I will need to implement what he call the advanced soltution. Anyone know if its possible to do something like that with NHibernate 1.0 ?

http://www.jroller.com/page/wakaleo/?anchor=hibernate_optimisation


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 5:19 am 
Beginner
Beginner

Joined: Mon Oct 03, 2005 4:59 am
Posts: 26
Location: Cambridge, UK
Hrm, I thought the thing to do to get lazy loading of many-to-one properties was to use proxies in the mapping? I haven't experimented with that yet, but it seems like a lot cleaner solution that what that article suggested.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 5:27 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Unfortunately NHibernate 1.0 is a port of Hibernate 2 which doesn't support lazy loading of specific properties which means you'd need ot use a data transfer object as described earlier in the post you referred to.

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 10:23 am 
Newbie

Joined: Thu Sep 08, 2005 12:15 pm
Posts: 17
Thanks for your reply guys! I used the "select new" clause and it drasticly improve the performance of my apps. I created an object with only the properties that i needed.. but yes it would have been much more cleaner if i could used the method explained in the aricle. btw I though that NHibernate 1,0 was a port of Hibernate 2.1 and the article seems to use Hibernate 2.1 thats why i asked if it was possible to replicate the solution with NHibernate.

Simon


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 12:25 pm 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Hi Simon,

Hmm...Looks like you and I are working on the same sort of thing at the same time. I've just posted a request for info on using 'select new' because I can't get it to work. I always get a 'class not found' exception for the data transfer class.

Any hints?

Cheers,

Symon.


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.