Which code, when added to the stateless session bean class, injects an EntityManagerFactory at runtime?

A developer writes an enterprise application and packages it into an .ear file. The application
contains two persistence units defined at the .ear level with persistence unit names FooPU and
BarPU. The application also contains an ejB. jar with one stateless session bean. Which code,
when added to the stateless session bean class, injects an EntityManagerFactory at runtime?

A developer writes an enterprise application and packages it into an .ear file. The application
contains two persistence units defined at the .ear level with persistence unit names FooPU and
BarPU. The application also contains an ejB. jar with one stateless session bean. Which code,
when added to the stateless session bean class, injects an EntityManagerFactory at runtime?

A.
@PersistenceUnit
private EntityManagerFactory emf;

B.
@PersistenceContext
private EntityManagerFactory emf;

C.
@PersistenceUnit(unitName=”BarPU”)
private EntityManagerFactory emf;

D.
@Resource(name=”BarPU”,type=EntityManagerFactory.class)
private EntityManagerFactory emf;



Leave a Reply 0

Your email address will not be published. Required fields are marked *