I'm trying to implement a simple interceptor that will automatically apply a CreateDate/UpdateDate values when an object is created or updated. I've scoured the documentation and forums at NHibernate, and I'm left wondering if there is an open bug with Spring.NET/Open Session in View.
Looking at this forum thread, it appears that even though there was a bug being discussed in 2006-2008, as of this month someone was still having to manually create a sessionfactory (see last post in the thread). Does anyone know how to get this working? Here is my configuration (namespaces removed):
Hibernate config
<object id="UserService" type="...Service.Users.UserServiceHibernate, ...Service">
<property name="HibernateTemplate" ref="HibernateTemplate" />
</object>
<object id="persistentEntityInterceptor" type="...Service.PersistentObjectInterceptor, ...Service">
</object>
<object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate, Spring.Data.NHibernate">
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
<property name="EntityInterceptor" ref="persistentEntityInterceptor"/>
</object>
<object id="TransactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate20">
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactory" ref="NHibernateSessionFactory"/>
<property name="EntityInterceptor" ref="persistentEntityInterceptor"/>
</object>
web.config
<appSettings>
<add key="Spring.Data.NHibernate.Support.OpenSessionInViewModule.SessionFactoryObjectName" value="NHibernateSessionFactory"/>
<add key="Spring.Data.NHibernate.Support.OpenSessionInViewModule.EntityInterceptorObjectName" value="persistentEntityInterceptor"/>
</appSettings>
With these settings, I get the following error when I try to do anything using HibernateTemplate:
No object named 'persistentEntityInterceptor' is defined : Cannot find definition for object [persistentEntityInterceptor]