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!

GeReV
  • 3,195
  • 7
  • 32
  • 44

1 Answers1

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?

Community
  • 1
  • 1
Michael Maddox
  • 12,331
  • 5
  • 38
  • 40