1 25 package org.objectweb.easybeans.tests.common.resources; 26 27 import javax.persistence.EntityManager; 28 import javax.persistence.PersistenceContext; 29 30 import org.objectweb.easybeans.tests.common.ejbs.entity.ebstore.EBStore; 31 32 33 39 public class EntityManagerTester { 40 41 44 public static final String NAME = "Toto2"; 45 46 49 @PersistenceContext(unitName="testEntity00") 50 private EntityManager entityManager = null; 51 52 55 public EntityManagerTester(){ 56 57 } 58 59 63 protected void access00() throws Exception { 64 checkInstance(entityManager, NAME); 65 } 66 67 73 public static void checkInstance(final EntityManager entityManager, final String name) throws Exception { 74 EBStore store = new EBStore(); 75 store.setId(store.hashCode()); 76 store.setName(name); 77 entityManager.persist(store); 78 entityManager.flush(); 79 80 if (entityManager.find(EBStore.class, Integer.valueOf(store.hashCode())) == null){ 81 throw new Exception ("EBStore was created, but it wasn't found after the commit."); 82 } 83 } 84 } 85 | Popular Tags |