Is it possible to define a spring-managed EJB3 hibernate listener?
I have this definition in my persistence.xml:
<properties> <property name='hibernate.ejb.interceptor' value='my.class.HibernateAuditInterceptor' /> <property name='hibernate.ejb.event.post-update' value='my.class.HibernateAuditTrailEventListener' /> </properties>
But I would like to manage HibernateAuditInterceptor and HibernateAuditTrailEventListener with spring, so I can do some bean injection (ex: session-scoped bean) within these classes. Is this possible?
The problem is that those properties are just strings. Even if you define your SessionFactory as a Spring bean, any properties you pass to it through the hibernateProperties setter are just strings:
So I don’t think you can do that.