Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spring boot hibernate entitymanager

EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("persistence");
		EntityManager entityManager = entityManagerFactory.createEntityManager();
 
		entityManager.getTransaction().begin();
		Employee employee = new Employee();
		employee.setName("Sanjay");
 
                // Save Entity
		entityManager.persist(employee);
		entityManager.getTransaction().commit();
		System.out.println("Generated Employee ID = " + employee.getEmployeeId());
Source by frugalisminds.com #
 
PREVIOUS NEXT
Tagged: #spring #boot #hibernate #entitymanager
ADD COMMENT
Topic
Name
3+2 =