views:

36

answers:

1

There mere presence of a custom DefaultSaveEventListener subclass containing no overidden or extended behaviour is enough to trigger this bizarre exception for me when flushing or committing a transaction, using the following configuration Xml:

<event type="save-update">
    <listener class="MyNamespace.MyCustomSaveEventListener, MyAssembly" />
</event>

If I comment out the above, it works fine. But like I say, this occurrs even though there is no overridden or extended event listener behaviour defined. I am aware that these <event> elements don't appear to be additive to the default NHibernate configuration, so whatever is configured in this element replaces everything else, hence the common practice of deriving from default implementations.

The exception occurs in the class NHibernate.Event.Default.DefaultSaveOrUpdateEventListener within the ReassociateIfUninitializedProxy method. It occurs even with only this listener registered and all other interception/extensions removed from the factory configuration.

Anybody any ideas on this? I need to implement some extended behaviour using this listener interface. Catching the exception and throwing it away doesn't appear to do any damage but what should the return value be?

A: 

Whoops was deriving from DefaultSaveEventListener instead of DefaultSaveOrUpdateEventListener ... changing the superclass made the problem go away - should open my eyes.

Rabid