Hello,
i have implemented an AuditLog-Interceptor inside an Jboss-Application based upon this thread
http://forum.hibernate.org/viewtopic.php?t=932065.
The sessionFactory necessary to store the audit-entries did i inject into the JNDI via persistence.xml and can now get a new session via:
Code:
InitialContext ctx = new InitialContext();
SessionFactory factory = (SessionFactory) ctx.lookup("java:hibernate/SessionFactory");
Session s = factory.openSession(factory.getCurrentSession().connection());
Now i have the problem, how to handle rollbacks of operations in the application. As far as i understand, jboss and my code use the
same EntityManagerFactory, but then Jboss injects always "org.jboss.ejb3.entity.TransactionScopedEntityManager" into beans, while i'm getting only "org.hibernate.impl.SessionFactoryImpl" in the interceptor.
SessionFactoryImpl doesn't share the actual persistence contexct and JTA-Transaction with the calling bean, am i right ?
So the question, how to get the audit entries rollbacked in case of an rollback in the original bean-method [using CMP] ?