I have an audit log listener I created to add a record to a different
table when specific entities have changed. It's been working fine, but
as soon as we added a component to one of our mappings, it started to
throw InvalidCastException: Can't cast MyComponentType to Object[] in
the FindModified method of event.Persister. Here is the code I am
using:

      public bool OnPreUpdate( PreUpdateEvent evt )
      {
         // Determine which indexes are dirty, and produce an
AuditLogEntry
         int[] indexes = evt.Persister.FindModified( evt.State,
evt.OldState, evt.Entity, evt.Session );

         //... more code to get a session and persist

In this instance I'm saving a User type that has a component mapping
for MyComponentType.

The exception is being throw on the FindModified call. Here is a stack
trace:

System.InvalidCastException: Unable to cast object of type
'MyApp.MyComponentType' to type 'System.Object[]'.
at NHibernate.Type.ComponentType.IsModified(Object old, Object
current, Boolean[] checkable, ISessionImplementor session)
at NHibernate.Type.TypeFactory.FindModified(StandardProperty[]
properties, Object[] x, Object[] y, Boolean[][] includeColumns,
Boolean anyUninitializedProperties, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.FindModified
(Object[] old, Object[] current, Object entity, ISessionImplementor
session)
at MyApp.AuditLogEventListener.OnPreUpdate(PreUpdateEvent evt) in
AuditLogEventListener.cs: line 58


Has anyone run into this before? Is it possible to FindModified on
component mappings?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to