NHibernate Envers - error at many-to-many relationship with the same type

410 views Asked by At

I'm totally new to NHibernate Envers, I have added new field to the entity mapping many-to-many relationship.

public class Product 
{
// initialization in ctor
...
public virtual ISet<FundProduct> ExcludedFromConversion { get; set; }
...
// mapping in ClassMap
            Set(x => x.ExcludedFromConversion, m =>
            {
                m.Table("ExcludedProduct");
                m.Cascade(Cascade.None);
                m.Key(k => k.Column("ProdId"));
            }, map => map.ManyToMany(p => p.Column("ExcludedProdId")))
...
}

and this line in Envers configuration keep throwing an exception:

protected virtual void ConfigureEnvers() 
{
...       
configuration.IntegrateWithEnvers(enversConf);
}

Message "Cannot cast 'NHibernate.Mapping.Formula' to 'NHibernate.Mapping.Column'." and top of the stack trace: in " w NHibernate.Envers.Tools.MappingTools.b__0(ISelectable f) in System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() (...)

I have tried to disable the auditing for this propety by adding [NotAudited] and [Audited(TargetAuditMode = RelationTargetAuditMode.NotAudited)] but it didn't help.

It works without Envers (with the ConfigureEnvers method disabled).

Any help/ideas are appreciated, thanks!

1

There are 1 answers

6
Roger On BEST ANSWER

Probably this issue. It has been fixed in latest envers version (2.0 CR1 - it has just been released). What version are you using?