CLONE - Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'.

Description

I have an object mapping where I defined a property that uses a formula. When I try to start the application this is the error message I get with Nhibernate.Envers.

Here is the stack trace.
[InvalidCastException: Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'.]
NHibernate.Envers.Tools.MappingTools.<SameColumns>b__0(ISelectable f) +25
System.Linq.WhereSelectListIterator`2.MoveNext() +104
System.Linq.Enumerable.Count(IEnumerable`1 source) +4081813
NHibernate.Envers.Tools.MappingTools.SameColumns(IEnumerable`1 first, IEnumerable`1 second) +200
NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder.createAuditMappedByAttributeIfReferenceImmutable(Collection collectionValue, Property referencedProperty) +70
NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder.addBidirectionalInfo(IDictionary`2 metas) +285
NHibernate.Envers.Configuration.Store.AuditMappedByMetaDataAdder.AddMetaDataTo(IDictionary`2 currentMetaData) +5
NHibernate.Envers.Configuration.Store.MetaDataStore.initializeMetas(IMetaDataProvider metaDataProvider, IEnumerable`1 metaDataAdders) +84
NHibernate.Envers.Configuration.AuditConfiguration..ctor(Configuration cfg, IMetaDataProvider metaDataProvider) +99
NHibernate.Envers.Configuration.AuditConfiguration.GetFor(Configuration cfg) +181
NHibernate.Envers.Event.AuditEventListener.Initialize(Configuration cfg) +10
NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg, Object[] list) +157
NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg) +446
NHibernate.Cfg.Configuration.GetInitializedEventListeners() +75
NHibernate.Cfg.Configuration.BuildSessionFactory() +154
Spring.Data.NHibernate.LocalSessionFactoryObject.NewSessionFactory(Configuration config) in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Data.NHibernate\Data\NHibernate\LocalSessionFactoryObject.cs:922
Spring.Data.NHibernate.LocalSessionFactoryObject.AfterPropertiesSet() in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Data.NHibernate\Data\NHibernate\LocalSessionFactoryObject.cs:678
Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InvokeInitMethods(Object target, String name, IConfigurableObjectDefinition definition) in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:1319
Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:1872
Spring.Objects.Factory.Support.WebObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Web\Objects\Factory\Support\WebObjectFactory.cs:450
Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) in f:\bamboo-home\xml-data\build-dir\SPRNET-RELEASE-JOB1\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:946

Environment

None

Attachments

1

Activity

Show:

Mihai Marandici July 28, 2014 at 9:53 AM
Edited

Entity model change for unit tests project in the current sources. After the change, nhibernate fails initialization with the exception described in the bug.
The scenario: there is an audited entity A which has one to many relation (with the collection property defined) with audited entity B. Entity B has a formula property defined.
This is reproducible on the current sources also.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created July 28, 2014 at 9:38 AM
Updated August 5, 2014 at 4:10 PM
Resolved August 5, 2014 at 4:10 PM
Who's Looking?