[jboss-user] [EJB3] - EntityManager in a @Service

Andrea Polci do-not-reply at jboss.com
Mon Apr 18 03:57:45 EDT 2011

Andrea Polci [http://community.jboss.org/people/apolci] created the discussion

"EntityManager in a @Service"

To view the discussion, visit: http://community.jboss.org/message/600535#600535

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,

Reply to this message by going to Community

Start a new discussion in EJB3 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110418/fe7d5410/attachment.html 

More information about the jboss-user mailing list