nhibernatenhibernate-validatornhibernate-envers

nhibernate validator and envers together


I am trying to use both nhibernate validator and nhibernate envers together in the same project.... but i am getting the null expection:

If i iniitliaze the validator later, i get the error:

Mesage: Object reference not set to an instance of an object.
StackTrace:
   at NHibernate.Validator.Engine.SystemTypeExtensions.ShouldNeedValidation(Type clazz)
   at NHibernate.Validator.Engine.ValidatorEngine.GetClassValidator(Type entityType)
   at NHibernate.Validator.Engine.ValidatorEngine.AddValidator(Type entityType, IValidatableSubElementsInspector inspector)
   at NHibernate.Validator.Event.ValidatePreInsertEventListener.Initialize(Configuration cfg)
   at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg, Object[] list) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\EventListeners.cs:line 618
   at NHibernate.Event.EventListeners.InitializeListeners(Configuration cfg) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\EventListeners.cs:line 592
   at NHibernate.Cfg.Configuration.GetInitializedEventListeners() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1189
   at NHibernate.Cfg.Configuration.BuildSessionFactory() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1246
   at ....Installers.NHibernateInstaller.SessionFactoryFactory(INHibernateConfigurator nHibernateConfigurator, INHibernateEnversConfigurator nHibernateEnversConfigurator) in ...\Installers\NHibernateInstaller.cs:line 81

but if i do the other way round, i get the error:

Mesage: Object reference not set to an instance of an object.
StackTrace:
   at NHibernate.Validator.Cfg.ValidatorInitializer.ApplyValidatorToDDL(PersistentClass persistentClass, ValidatorEngine ve)
   at NHibernate.Validator.Cfg.ValidatorInitializer.Initialize(Configuration cfg, ValidatorEngine ve)
   at NHibernate.Validator.Cfg.ValidatorInitializer.Initialize(Configuration cfg)
   at ....NHibernateInstaller.SessionFactoryFactory(INHibernateConfigurator nHibernateConfigurator, INHibernateEnversConfigurator nHibernateEnversConfigurator) in ...\Installers\NHibernateInstaller.cs:line 83

has anyone tried this before?? how to fix this??

Thanks, harish


Solution

  • I believe this is a known issue for NHV, https://nhibernate.jira.com/browse/NHV-117.