ExamQuestions.com

Register
Login
Java EE 7 Application Developer Exam Questions

Oracle

Java EE 7 Application Developer

18 / 72

Question 18:

Given the code fragments: 
image
What code should you add to the body of the updateEmployee method in order to save pending changes to the database? 

Answer options:

A. entityManager.merge(emp);
B. Context. Ctx = new InitialContext(); UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/UserTransaction"); utx.begin(); entityManager.merge(emp); utx.commit();
C. entityManager.lock(emp); EntityManager.merge(emp);
D. entityManager.getTransaction().begin(); entityManager.merge(emp); entityManager.getTransaction().commit();