1

I've been trying to get NHibernate into development for a project I'm working on at my workplace.

Since I have to put a strong emphasis on performance, I've been running a proof-of-concept stress test on an existing project's table with thousands of records, all of which contain a large text column.
However, when selecting a collection of these records, the select statement takes a relatively long time to execute; apparently due to the aforementioned column.

The first solution that comes to mind is setting this property as lazy:

<property name="Content" lazy="true"/>

But there seems to be no difference in the SQL generated by NHibernate. My question is, how do lazy properties behave in NHibernate? Is there some kind of type limitations I could be missing? Should I take a different approach altogether?

Using HQL's new Class(column1, column2) approach works, but lazy properties sounds like a simpler solution.

It's perhaps worth mentioning I'm using NHibernate 2.1.2GA with the Castle DynamicProxy.

Thanks!

1 Answer 1

5

To do lazy properties with 2.1.*, try this:

http://ayende.com/Blog/archive/2007/08/26/Lazy-Property-Loading-In-NHibernate.aspx

Lazy properties are much easier and fully supported in the trunk (3.X):

http://ayende.com/Blog/archive/2010/01/27/nhibernate-new-feature-lazy-properties.aspx

See also:

Lazy property loading in Nhibernate and Spring

NHibernate: lazy loaded properties?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.