Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-1478

Use lazy properties of NHibernate in Spring.NET

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.2
    • Fix Version/s: 2.0 M1
    • Component/s: Spring-NET-NH
    • Labels:
      None
    • Environment:
      Windows 7, Visual Studio 2010

      Description

      Hi,

      I worked in a project where we had to use NHibernate's lazy properties feature. Our mapping class was perfectly fit for this feature, but NHibernate assembled the SQL queries along with the lazy columns (thus, the properties were eagerly loaded). To identify this problem, we logged NHibernate's Tuple.Entity namespace. The following entry is relevant:

      "Disabled lazy properies fetching for XXXXX.XXX beacuse it does not support lazy at the entity level".

      Support for lazy properties is determined according to the lazyAvailable variable in the EntityMetamodel class. This variable was always false because Spring.NET used ProxyFactoryFactory. Its IsInstrumented method implementation always returns false. To overcome this problem, we decided to set the proxyfactory.factory_class key in NHibernate's properties to NHibernate.Bytecode.DefaultProxyFactoryFactory (where the return of IsInstrumented method always returns true).

      Shouldn't Spring.NET let NHibernate use its default DefaultProxyFactoryFactory class when the key isn't explicitly set?

      In order to help out developers who may face this problem, we decided to post this issue on jira.

        Attachments

          Activity

            People

            • Assignee:
              sbohlen Steve Bohlen
              Reporter:
              carlosedu_nogueira Carlos Eduardo Nogueira
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4d
                4d
                Remaining:
                Remaining Estimate - 4d
                4d
                Logged:
                Time Spent - Not Specified
                Not Specified