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.  [ 4 posts ] 
Author Message
 Post subject: Lazy load Component
PostPosted: Tue Jul 17, 2007 10:56 am 
Beginner
Beginner

Joined: Thu May 31, 2007 1:19 pm
Posts: 23
Hi

I have some objects with a great many properties, many of which are only occasionally needed.

Ideally, I would like some sort of lazy loading of the columns that are not needed, as it takes a long time to retrieve all columns for a large collection.

I know NHibernate doesn't support lazy loaded columns (shame!).

I have got the "component" working, which is great, but this doesn't seems to support lazy loading either (i.e. it would be nice if NHibernate could load all columns of a component and instantiate it when the component was accessed.

So, is the only way for me not to load all properties at once, to split my class into parts and set up one-to-one lazy relationships between the parts? This is going to be quite tedious, and make coding a little more complex.

In addition, my schema is such that a great many of the tables have the same sets of "little used" columns - more ideally suited to the component structure, I think?


Well, I would greatly appreciate thoughts on this issue.

Thanks,
Mark.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 7:01 pm 
Beginner
Beginner

Joined: Tue Jan 02, 2007 5:53 pm
Posts: 42
Location: Bergen, Norway
Hi!

Quote:
I know NHibernate doesn't support lazy loaded columns (shame!).

You should read this: http://hibernate.bluemars.net/403.html


Quote:
I have got the "component" working, which is great, but this doesn't seems to support lazy loading either (i.e. it would be nice if NHibernate could load all columns of a component and instantiate it when the component was accessed.

You have to do this manually, read this and this together with this from the manual.

Quote:
So, is the only way for me not to load all properties at once, to split my class into parts and set up one-to-one lazy relationships between the parts? This is going to be quite tedious, and make coding a little more complex.

No, you should not twist and bend you domain model to get hibernate to work properly for you. That would be bad OO. Hibernate embraces the POJO/POCO approaches for creating domain model classes.


Hope some of the links proved to be useful.
Cheers,
Steinar.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 18, 2007 7:10 am 
Beginner
Beginner

Joined: Thu May 31, 2007 1:19 pm
Posts: 23
Quote:


I read it. Nonethewiser. What have I missed?

Quote:
You have to do this manually, read this and this together with this from the manual.


Can't see how these help me lazily load components.

Quote:
No, you should not twist and bend you domain model to get hibernate to work properly for you. That would be bad OO. Hibernate embraces the POJO/POCO approaches for creating domain model classes.


Totally agree, in theory.

In practice, I am trying to load a very large collection of objects with a very large number of properties. This is inefficient. I need to the core properties always, and only load some of the lesser used properties when they're needed.

Thanks anyhow,
Mark.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 19, 2007 3:48 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
From my understanding a component is considered a part of the parent object and is completely tied to it's lifecycle, which includes loading. If you need lazy loading you should extend the associated objects to be full blown entities and use cascading to tie them to the lifecycle of the parent object.

Hope that helps.

Symon.


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