OldState is always null in event listener

Description

i am pretty new to NHibernate, but i believe this is a bug, because i have found that many other people have the same problem.
e.g. http://groups.google.com/group/nhusers/browse_thread/thread/28475b31df0d5d08
and http://www.mail-archive.com/nhusers@googlegroups.com/msg02337.html

In my specific instance i have created an event listener deriving from IPostUpdateEventListener (although i probably happens for other types of events too). And in the OnPostUpdate(PostUpdateEvent postUpdateEvent) method postUpdateEvent.OldState is always null.

this means that you cannot get the changed properties of the updated object.

i will look at trying to make a unit test which will reproduce this, however it should be pretty easy to do.

p.s we are getting close to the deadline for this project, so i would apprecieate it if someone could have a look at this soon

Environment

None

Activity

Show:

Fabio Maulo June 1, 2009 at 12:20 PM

Check NHibernate.Test.Events.PostEvents.PostUpdateFixture
if you want understand what happening and why.
Especially check the test "UpdateDetachedObject".

Matthew Fenner June 1, 2009 at 2:45 AM

i just wrote a unit test for this, and i didn't have the problem.

It could be that we need to use the latest version of NHibernate for the project i had this problem in. or the problem could be somewhere in Active Record (which we are using for the project.

i'll get back to you guys when i find the answer

Not an Issue

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created June 1, 2009 at 2:22 AM
Updated June 1, 2009 at 12:20 PM
Resolved June 1, 2009 at 12:20 PM
Who's Looking?