users@glassfish.java.net

EntityManager not injected in CDI decorated stateless bean

From: Oliver B. Fischer <mailsink_at_swe-blog.net>
Date: Mon, 09 Sep 2013 14:38:53 +0200

Hi,

I have an stateless EJB with an injected EntityManager instance. If
start to decorate the bean with an decorator via CDI, the entity manager
is never injected.

Any idea why the entity manager is null?

@Stateless
public class SDMPersistenceProvider implements SDMPersistence
{
     @PersistenceContext(unitName = "sdmPU")
     protected EntityManager em;

     ...
}

@Decorator
public abstract class SDMPersistenceDecorator
     implements SDMPersistence
{
     @Inject
     @Delegate
     SDMPersistence delegate;

    ....
}


Bye,

Oliver