Don't know much about NHV and guessing out loud here...

conf.IntegrateWithEnvers(...) will add persistent classes to the configuration 
object. Maybe NHV don't like modifications of the conf object after it has been 
initialized? What happens if you run Initialize after IntegrateWithEnvers?



From: [email protected] [mailto:[email protected]] On Behalf Of 
Jochen Jonckheere
Sent: den 2 maj 2011 11:02
To: [email protected]
Subject: [nhusers] Using Validator and Envers together

Hi,

When I try to use NHibernate.Envers and NHibernate.Validator in the same 
project I get the following exception.

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

Here's the part of the code that throws the exception:

// Build the NHibernate Configuration
var nHibernateConfiguration = nHibernateConfigurator.Configure();
// Initialize NHibernate Validator
nHibernateConfiguration.Initialize();
// Initialize NHibernate Envers
nHibernateConfiguration.IntegrateWithEnvers(nHibernateEnversConfigurator.Configure());

// Build the SessionFactory
_factory = nHibernateConfiguration.BuildSessionFactory();

The exception occurs on the last line. Has somebody succesfully combined Envers 
and Validator?

Regards,

Jochen
--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
To unsubscribe from this group, send email to 
[email protected]<mailto:[email protected]>.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

-- 
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