You can't mess with NH Session's internals if you want it to manage things
for you.
You can always use stateless sessions and retrieve the blob on demand, as
part of a different query, for example.

That said, you might be interested in this:
http://blog.calyptus.eu/seb/2009/03/large-object-storage-for-nhibernate-and-ddd-part-1-blobs-clobs-and-xlobs/

    Diego


On Thu, Oct 7, 2010 at 13:37, PLen <[email protected]> wrote:

> Hello,
>
> I have a Blob database column which gives the following in my class
> object:
>
>     public virtual byte[] Body { get; set; }
>
> And the following in my NHibernate mapping file:
>
>    <property name="Body" column="BODY" lazy="true"/>
>
> NOTE:  I am using NHibernate v3.0 A2 to get the property lazy loading.
>
> The lazy loading works fine.  I don't get the Blob content until I
> call my obj.Body.  If I do another obj.Body call, I see that
> NHibernate simply returns what it has stored in memory since it
> already got it once and does not go back to the database to get it a
> second time.  My problem is that I do not want to keep all the byte[]
> content around.  I might do a search and get 50 records.  If the user
> goes to view all 50, then I will have 50 byte[] objects in memory,
> that is if I didn't crash first from running out of memory.  What I
> want to be able to do is "reset" the obj.Body object (byte[]) after it
> is retrieved so that it no longer is in memory.  If the user chooses
> to see that content again, the obj.Body call will go back to the
> database for the content.
>
> I tried to set the byte[] to null as well as to a 0 length array after
> I used it, but I would either get an error (when using the null) or
> just get back a 0 length array when I called obj.Body again.
>
> Is there a way to do something to the object to remove its value from
> memory so NHibernate doesn't think it retrieved the content yet?
>
> Any thoughts would be greatlty appreciated.
>
> Thanks - Peter
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to