Just throw the exception away.  All the persistence you've performed
will be fine.

using System;
using NHibernate;
using NHibernate.Event;
using NHibernate.Event.Default;


namespace YourNamespace.EventListeners {
    [Serializable]
    public class PostFlushFixEventListener : DefaultFlushEventListener
{

        public override void OnFlush(FlushEvent @event) {
            try {
                base.OnFlush(@event);
            }
            catch (AssertionFailure) {
                // throw away
            }
        }
    }
}


On Jan 12, 12:28 pm, Shane C <[email protected]> wrote:
> I'm trying to do the standard auditing via PreUpdate/InsertEvents and
> I'm getting an error which seems a bit odd:
>
>  An AssertionFailure occurred - this may indicate a bug in NHibernate
> or in your custom types.
> NHibernate.AssertionFailure: collection
> [Husky.CFIN.Domain.Security.User.SecurityGrants] was not processed by
> flush()
>
> I'm actually not even sure why the code cares about SecurityGrants at
> all considering the following says to treat SecurityGrants as lazy
> which means it should be ignored.. No?
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                    namespace="****.Security"
>                    assembly="****"
>                    default-access="property"
>                    default-lazy="false"
>                    default-cascade="none" >
>   <class name="User" table="USER" lazy="true">
>     <id name="Id" column="USER_ID">
>       <generator class="seqhilo">
>         <param name="sequence">USER_SEQ</param>
>         <param name="max_lo">100</param>
>       </generator>
>     </id>
>
>     <property name="AccountName" column="ACCOUNT_NAME" />
>     <property name="SystemNotificationType"
> column="SYSTEM_NOTIFICATION_TYPE"/>
>
>     <bag name="SecurityGrants" cascade="all-delete-orphan"
> access="field.pascalcase-m-underscore" lazy="true" fetch="subselect">
>       <key column="USER_NAME_ID"/>
>       <one-to-many class="Husky.CFIN.Domain.Security.SecurityGrant,
> CFIN.Domain"/>
>     </bag>
>   </class>
> </hibernate-mapping>
-- 
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