CDI Injection in Hibernate Entities

前端 未结 3 1740
小蘑菇
小蘑菇 2021-01-20 05:36

We are using CDI(JSR 299) in our application (JSF2/Seam3.0/Hibernate 3.5.6/GlassFish 3.1.1)

While we are unable to inject resources(Helper POJOs) in our managed bean

3条回答
  •  滥情空心
    2021-01-20 06:07

    you can firing CDI Events in a JPA Entity or EntityListener. and inject the TestClass to the class which contains Observes method. look at following link for more information: http://blogs.bytecode.com.au/glen/2014/01/09/firing-cdi-events-from-a-jpa-entitylistener.html

    you can also access to the BeanManager as follow( instead JNDI lookup)

    CDI.Current().getBeanManager()

提交回复
热议问题