-->
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 an Blob property
PostPosted: Wed Sep 24, 2008 12:07 pm 
Newbie

Joined: Wed May 07, 2008 2:56 pm
Posts: 4
2.0

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<joined-subclass extends="CMS.Domain.Content,CMS.Domain" name="CMS.Domain.File,CMS.Domain" table="`Files`" lazy="true">
<key column="`ID`" />

<property name="ContentType" column="`ContentType`" type="System.String" not-null="true" />
<property name="ContentLength" column="`ContentLength`" type="System.Int32" not-null="true" />
<property name="ContentExtension" column="`ContentExtension`" type="System.String" not-null="true" />
<property name="FileName" column="`FileName`" type="System.String" not-null="true" />
<property name="Data" column="`Data`" type="BinaryBlob" not-null="true" />
<one-to-one name="Content" cascade="save-update" />
</joined-subclass>
</hibernate-mapping>


Sql Server 2005


I'm attempting to get lazy loading working for a single property in my File class. The property is an image field in the database and it's been killing my performance. I've looked everywhere I could think of and cannot find an example of how to do this properly. If anyone could point me to an article or just show me how I would really appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 2:10 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
What about putting the BLOB data in a separate class and joining it with a one-to-one to the main object. Then you can use hibernates lazy loading mechanism.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 25, 2008 2:05 pm 
Beginner
Beginner

Joined: Wed Mar 14, 2007 12:35 pm
Posts: 24
Not that this helps you now, but it looks as though 2.1 will support property lazy-loading. The mapping xsd now includes lazy on the property. I've seen alot of stub code around it in the trunk as well.


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

Joined: Wed Mar 11, 2009 10:08 pm
Posts: 4
If you have really large images in your database you may want to check this out: http://forum.hibernate.org/viewtopic.php?t=995551


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.