xxxxxxxxxx
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());
xxxxxxxxxx
entityManager.getTransaction().begin();
entityManager.remove(emp);
entityManager.getTransaction().commit();
xxxxxxxxxx
List<Employee> emplList= entityManager.createQuery("SELECT UPPER(e.name) FROM Employee e").getResultList();
xxxxxxxxxx
//Select Query
List<Employee> emplList= entityManager.createQuery("SELECT e FROM Employee e").getResultList();