I am trying to implement Hibernate db auditing like
http://www.hibernate.org/48.html (but
adding field, oldValue, and newValue), and I need to create the Session with my custom
Hibernate Interceptor, which is given the User ID in the constructor.
The only place in Seam I see any version of SessionFactory.openSession() being used is in
ManagedHibernateSession.initSession(), but I don't really see how to get my
Interceptor in there. I could extend ManagedHibernateSession and inject currentUser, but
how do I configure Seam to use my extended class? I see the Portal sample app pointing to
ManagedHibernateSession in components.xml, but we are using EntityManager, with
managed-persistence-context declared in components.xml, not Session.
How do I configure a Hibernate Interceptor in Seam?
Or, is there a better way to do Audit logging in Seam? At first I was looking at using the
@EntityListeners annotation, but it would involve lots of Reflection, and there
doesn't seem to be a way to get at the previous values of the Entity's properties
anyway.
org.hibernate.Interceptor.onFlushDirty() gives me all that (too bad it doesn't also
give me boolean isDirty[]), but I don't see how to get it configured within Seam.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093712#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...