1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.entitymanager; 26 27 import javax.ejb.Remote ; 28 import javax.ejb.Stateless ; 29 import javax.persistence.EntityManager; 30 import javax.persistence.PersistenceContext; 31 import javax.persistence.PersistenceContextType; 32 33 import org.objectweb.easybeans.tests.common.ejbs.entity.ebstore.EBStore; 34 35 41 @Stateless 42 @Remote (ItfEntityManagerTester00.class) 43 public class SLSBEntityManagerTester00 implements ItfEntityManagerTester00 { 44 45 48 @PersistenceContext(type = PersistenceContextType.TRANSACTION) 49 private EntityManager em; 50 51 57 private EBStore completeEBStore(final int id, final String name) { 58 EBStore ebstore = new EBStore(); 59 ebstore.setId(id); 60 ebstore.setName(name); 61 return ebstore; 62 } 63 64 69 public EBStore findEBStore(final int id) { 70 return em.find(EBStore.class, new Integer (id)); 71 } 72 73 77 public void removeEBStore(final int id) { 78 EBStore ebstore = findEBStore(id); 79 if(ebstore != null){ 80 em.remove(ebstore); 81 } 82 } 83 84 89 public void createEBStoreNew(final int id, final String name) { 90 em.persist(completeEBStore(id, name)); 91 } 92 93 99 public void createEBStoreManaged(final int id, final String name) { 100 EBStore ebstore = completeEBStore(id, name); 101 em.persist(ebstore); 102 em.persist(ebstore); 103 } 104 105 111 public void createEBStoreRemoved(final int id, final String name) { 112 EBStore ebstore = completeEBStore(id, name); 113 em.persist(ebstore); 114 em.remove(ebstore); 115 em.persist(ebstore); 116 } 117 118 123 public void removeEBStoreRemoved(final int id, final String name) { 124 EBStore ebstore = completeEBStore(id, name); 125 em.persist(ebstore); 126 em.remove(ebstore); 127 em.remove(ebstore); 128 } 129 130 135 public void removeEBStoreManaged(final int id, final String name) { 136 EBStore ebstore = completeEBStore(id, name); 137 em.persist(ebstore); 138 em.remove(ebstore); 139 } 140 141 146 public void removeEBStoreNew(final int id, final String name) { 147 EBStore ebstore = completeEBStore(id, name); 148 em.remove(ebstore); 149 } 150 } 151 | Popular Tags |