-->
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.  [ 5 posts ] 
Author Message
 Post subject: Design question:why a component can't be lazily initialized?
PostPosted: Fri Oct 08, 2004 10:26 am 
Newbie

Joined: Mon Jul 26, 2004 4:55 am
Posts: 4
Hi all,

Example of use :

I want to store files in the database. For performance reasons, I want to be able to retrieve the name of the file without loadind its data.

The solution would be to :
* have a File class with its properties (name, type, ...) and a FileData class with the bytes. There is a one to one relation beetween the 2 classes.
* map the 2 classes on the same table, FileData being a lazy loaded component of File.

Does it makes sense? Someone with a better idea for this mapping?

Thanks,
Gaetan


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:36 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
check the lightweight pattern in the wiki area

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:47 am 
Newbie

Joined: Mon Jul 26, 2004 4:55 am
Posts: 4
Thanks a lot. It is exactly what I want to do.

_________________
Gaetan Zoritchak


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 6:22 am 
Newbie

Joined: Mon Jul 26, 2004 4:55 am
Posts: 4
However, the LightWeigh pattern is a way of resolving the problem. But sometimes delegation is a best pattern and allowing lazy init on component would be great.

_________________
Gaetan Zoritchak


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 06, 2004 6:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You can do that on H3
From the roadmap
Quote:
Column-level lazy fetching (done)

This is a checkbox feature that Hibernate needs for marketing purposes. Any property may be marked lazy="true", and will be fetched from the database when the field is first accessed. This feature requires build-time bytecode instrumentation using an Ant task. If Hibernate encounters uninstrumented classes at runtime, the feature will be transparently disabled.

_________________
Emmanuel


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