ILoadEventListener: Load Events Run Rampant (Fire Multiple Times)

Description

In a collection mapping setup, where the parts have a reference back to the containing entity, the load event for the containing entity fires many times.

Let Product -> Parts be the model being mapped. A product has a list of parts and each Part has a reference to the parent product. Product Saves are cascaded with cascade "all" or "all-delete-orphan". This is observed:

When loading a product, one product load event occurs correctly.
When accessing the Parts collection, another product load event occurs.
A product load event occurs each time a part is hydrated.

There should be exactly one load event.

Before running the attached sample:

  • create an empty "Products" database

  • edit the NHibernate settings found in App.config (dialect, connection string, etc.)

  • copy the following libraries from the NHibernate 2.0.0b2 distribution into the Lib directory:
    Castle.Core.dll, Castle.DynamicProxy2.dll, Iesi.Collections.dll, NHibernate.dll

The sample was run in Visual Studio 2008 with .NET Framework 3.5. The database provider was MS SQL Server 2005.

Environment

None

Attachments

1

Activity

Show:
Not an Issue

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created August 15, 2008 at 7:07 AM
Updated October 13, 2008 at 6:07 AM
Resolved October 13, 2008 at 6:07 AM
Who's Looking?