hibernate initialize entity manager code example
Example: Create EntityManager Hibernate
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("Books");
EntityManager entityManager = entityManagerFactory.createEntityManager();