View Javadoc
1   package ejava.examples.txhotel.ejb;
2   
3   import javax.ejb.Stateless;
4   import javax.persistence.EntityManager;
5   import javax.persistence.PersistenceContext;
6   
7   import org.slf4j.Logger;
8   import org.slf4j.LoggerFactory;
9   
10  /**
11   * This EJB provides helper methods used by remote test clients.
12   */
13  @Stateless
14  public class TestUtilEJB implements TestUtilRemote {
15      private static final Logger log = LoggerFactory.getLogger(TestUtilEJB.class);
16  
17      @PersistenceContext(unitName="txhotel")
18      private EntityManager em;
19  
20      @Override
21  	public void reset() {
22      	log.info("resetting the hotel DB tables");
23      	em.createQuery("delete from Reservation").executeUpdate();
24      	em.createQuery("delete from Person").executeUpdate();
25  	}
26  
27  }