Perhaps the problem is not there... what you think ? state and oldstate of any entity/component are stored as array-of-values in NH.
2010/2/3 Sean Chambers <[email protected]> > It seems like the problem is in ComponentType.IsModified method, > ComponentType.cs, line 542: > > object[] oldValues = (Object[]) old; > > Although, I must admit i'm not sure why this method is trying to take > the input to the method, that would be the component type and attempt > to map it into a collection of old values. > > I should also mention I'm using fluent nhibernate for the mapping > portions. > > Thanks > > Sean > > On Feb 2, 11:37 pm, Sean Chambers <[email protected]> wrote: > > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- Fabio Maulo -- 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.
