1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.persistencectxref; 26 27 import static org.objectweb.easybeans.tests.common.helper.ContextHelper.checkEntityManager; 28 29 import javax.annotation.Resource; 30 import javax.ejb.Remote ; 31 import javax.ejb.SessionContext ; 32 import javax.ejb.Stateless ; 33 import javax.persistence.EntityManager; 34 import javax.persistence.PersistenceContext; 35 36 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck00; 37 38 39 44 @Stateless (name = "SLSBPCtxRefMethodInjection00") 45 @Remote (ItfCheck00.class) 46 public class SLSBPCtxRefMethodInjection00 implements ItfCheck00 { 47 48 51 @Resource 52 private SessionContext sessionContext; 53 54 57 private EntityManager em00; 58 59 62 private EntityManager em01; 63 64 67 private EntityManager em02; 68 69 73 @PersistenceContext(name = "persistence/pu00") 74 public void setPersistenceUnit00(final EntityManager em) { 75 em00 = em; 76 } 77 78 82 @PersistenceContext(name = "persistence/pu01", unitName = "testEntity00") 83 public void setPersistenceUnit01(final EntityManager em) { 84 em01 = em; 85 } 86 87 91 @PersistenceContext(unitName = "testEntity00") 92 public void setEmf02(final EntityManager em) { 93 em02 = em; 94 } 95 96 103 public void check() { 104 checkEntityManager(sessionContext, em00, "persistence/pu00"); 105 checkEntityManager(sessionContext, em01, "persistence/pu01"); 106 checkEntityManager(sessionContext, em02, this.getClass().getName() + "/emf02"); 107 } 108 } 109 | Popular Tags |