List of usage examples for javax.persistence EntityManagerFactory close
public void close();
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/*from ww w. j ava 2s . co m*/ service.findAllProfessors(); util.checkData("select * from Professor"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Message.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/*from w w w. jav a 2s . c o m*/ service.messageCreateAndList(); util.checkData("select * from Message"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/*from w w w. j av a 2 s . c o m*/ util.checkData("select * from CONTRACT_EMP"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();//from w w w . ja v a 2 s. co m service.lockAllProfessors(); util.checkData("select * from Professor"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Main.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/*from w ww. jav a 2 s .c o m*/ service.findAll(); util.checkData("select * from Professor"); util.checkData("select * from Department"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/* w w w . ja va2 s . c o m*/ Professor emp = service.createProfessor("AAA", 45000); em.getTransaction().commit(); System.out.println("Persisted " + emp); util.checkData("select * from Professor"); em.close(); emf.close(); }
From source file:Department.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();//w w w . j a v a 2s. com service.createProfessor(1, "empName", 1); util.checkData("select * from Professor"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();//from w w w . j ava2 s . c o m //service.removeDepartment2(); util.checkData("select * from Professor"); util.checkData("select * from Department"); em.getTransaction().commit(); em.close(); emf.close(); }
From source file:Professor.java
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); util.executeSQLCommand("CREATE SEQUENCE Emp_Seq;"); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();/* w w w.j a va2 s. c om*/ Professor emp = service.createProfessor("name", 100); em.getTransaction().commit(); System.out.println("Persisted " + emp); util.checkData("select * from Professor"); em.close(); emf.close(); }
From source file:Address.java
License:asdf
public static void main(String[] a) throws Exception { JPAUtil util = new JPAUtil(); EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService"); EntityManager em = emf.createEntityManager(); ProfessorService service = new ProfessorService(em); em.getTransaction().begin();//from www.j a va2s . c o m service.addProfessor("12"); util.checkData("select * from EMP"); em.getTransaction().commit(); em.close(); emf.close(); }