Advertisement
aleon1220

Use of JSF

Apr 8th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public Integer addEmployee(EmployeeEntity employee) {
  2.  
  3. EntityManagerFactory emf = null;
  4. EntityManager em = null;
  5. try {
  6. emf = Persistence.createEntityManagerFactory("Employee_Mgmt");
  7. em = emf.createEntityManager();
  8. EntityTransaction et = em.getTransaction();
  9.  
  10. et.begin();
  11. em.persist(employee);
  12. et.commit();
  13.  
  14. return employee.getRegId();
  15. } finally {
  16. if (em != null)
  17. em.close();
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement