View Javadoc
1   package ejava.examples.jndidemo.dao;
2   
3   import javax.persistence.EntityManager;
4   
5   /**
6    * This class represents a simple base type for a JPA DAO.
7    * @param <T>
8    */
9   public class JPADAOBase<T> {
10  	protected EntityManager em;
11  
12  	public void create(T task) {
13  		em.persist(task);
14  	}
15  	public T update(T task) {
16  		return em.merge(task);
17  	}
18  	public void delete(T task) {
19  		em.remove(task);
20  	}
21  }