-->
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 loading of fileds
PostPosted: Mon Jan 21, 2008 9:21 am 
Newbie

Joined: Mon Jan 21, 2008 8:21 am
Posts: 2
Hi,

Is it possible to load the fields (selected fields in a domain object..ex..Blob fileds).

I have a student table and want to display all the students names and ID with a condition (ID < 100 or some other condition). Each student record has a blob field which holds the pic of the student and this pic is more than 2MB in size. If i load all the records from the query it may load 200MB+ data into the memory. I want to delay the loading of the image until i select a student and click on the image icon.

How to get this working.

Thanks for your time.
Tom.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 10:56 am 
Regular
Regular

Joined: Tue Dec 25, 2007 3:41 pm
Posts: 57
Location: Argentina
Hi,

If you are talking about lazy property fetching, it's not supported yet, this is the Hibernate doc:
http://www.hibernate.org/hib_docs/v3/re ... properties

Best regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 11:35 am 
Newbie

Joined: Mon Jan 21, 2008 8:21 am
Posts: 2
Thanks for the reply..

I found a way to retrieve only selected fields..

http://www.roseindia.net/hibernate/proj ... ions.shtml

But this approach is giving rows in object array.

Is there any better way where i can get Domain objects with few field set, and few fields lazily loaded.

Thanks
Tom.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 10, 2008 11:04 am 
Newbie

Joined: Fri May 25, 2007 4:37 am
Posts: 13
Location: Germany
Would be really nice to know. I have the exact same problem.

I have an Entity "File" that has a field of type Blob and a field with the size of the Blob. When I want to count the total size of all files, Hibernate would load all Blobs. Quiet stupid to do so.

What do you think about a OneToOne-Association with Lazy-Fetching?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 10, 2008 11:30 am 
Regular
Regular

Joined: Tue Dec 25, 2007 3:41 pm
Posts: 57
Location: Argentina
By the way, you can be a little tricky with this issue. In some cases you can create a entity "File" without the blog property, and later when you need to load a blob you request as a query.

At this moment, the Castle proxy need to support interception by field to support this feature, not only by property.

Best regards

_________________
Dario Quintana


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 11, 2009 11:00 pm 
Newbie

Joined: Wed Mar 11, 2009 10:08 pm
Posts: 4
If you are working with files of 2MB+ you may want to consider streaming the data. Check this out:

http://forum.hibernate.org/viewtopic.php?t=995551

I'm trying to get a discussion going around some new Blob and Clob types.


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.