views:

80

answers:

2

I've got some binary data that I store and was going to separate this out into a separate table so it could be lazy loaded.

However, i then came across this post by Ayende (http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx) which suggests that property lazy loading is now possible.

I have added the lazy="true" attribute to my property mapping but the field is still loaded from the database (I am using a simple text field to test).

My query:

                return _session.CreateQuery("from Product")
                .SetMaxResults(1)
                .UniqueResult<Product>();

Mapping:

<property name="Description" type="string" column="FullDescription" lazy="true"/>

Has anyone been able to get this working? Personally I prefer this approach than having to add another table to my database.

+2  A: 

It will be possible on nhibernate 3.0, on the current version is not possible. You can download the trunk code or wait for the 3.0 version :-)

Claudio Redi
+3  A: 

As the article states: "This feature is now available on the NHibernate trunk". So either NH 3.0 or the latest trunk.

mxmissile