java - Inject entityManager into custom Hibernate Interceptor class -
i want inject entitymanager hibernate on hibernate interceptor class. i'm using ejbs , jboss. transaction jta , provider org.hibernate.ejb.hibernatepersistence.
i tried that:
@stateless(name = "historicinterceptor") @transactionattribute(transactionattributetype.requires_new) public class historicinterceptorimpl extends emptyinterceptor implements historicinterceptor { @persistencecontext(name = "windi") private entitymanager em; // overriden methods, etc }
but reference entitymanager null.
is behaviour expected? how can access entitymanager within interceptor class?
i had given on exact solution. instead, i've created class has ejb annotations. interceptor call ejb using provider class lookup ejb classes on context of application. there, entitymanager correctly associated.
Comments
Post a Comment