• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3- hibernate JPA problem while creating hibernate interceptor

 
Rohan Kulkarni
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

My basic aim is do auditing on all tables for updates and deletes. I am using an EJB3 application which is in turns using Hibernate below it to make database calls.

I had implemented this kind of auditing before for spring-hibernate framework using Hibernate Interceptors.

So Now I am trying to do the same with EJB3. I specified my interceptor in persistence.xml file like - <property name="hibernate.ejb.interceptor" value="com.nihilent.model.audit.AuditLogInterceptor"/>

But I need an open hibernate session object in this interceptor class so that I can add audit entries into the database. I tried many tricks but they dint work. So guys give me some solution which really works....

I don't even get entityManager object in this class which I think is because this class is not recognized by EJB3 but only by hibernate.....

Guys please help me out here.... Am in desperate need of this.....

Thanks,
Rohan.
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you considered session bean interceptors?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic