6 Replies Latest reply on Apr 18, 2011 4:44 AM by Andrea Polci

    EntityManager in a @Service

    Andrea Polci Newbie

      I'm trying to write a @Service that need access to an EntityManager.

      I'll use the service throw the JMX console.


      The problem is that I can't find a way to inject the entity manager into the service.


      This is a simplified version of my code:


      public inteface MyManager {
         public void method(String argument);
      public class MyMBean implements MyManager {
        private EntityManager em;
        public void method(String argument) {
          // code using em



      The service get exposed throgh the jmx console, but em is always null.


      I tried to @Inject an entity manager configured in a @Producer, but i get the same result.


      I'm using JBoss AS 6.0.0 Final


      Thanks for any help,