Which two code fragments can be used on Line 22 to persist an order instance assuming that all references are properly initialized?

Given this Java EE application that uses a JTA application-managed entity manager:
20. UserTransaction utx = …;
21. utx.begin();
22. //insert code here

23. utx.commit();
Which two code fragments can be used on Line 22 to persist an order instance assuming that all
references are properly initialized? (Choose two.)

Given this Java EE application that uses a JTA application-managed entity manager:
20. UserTransaction utx = …;
21. utx.begin();
22. //insert code here

23. utx.commit();
Which two code fragments can be used on Line 22 to persist an order instance assuming that all
references are properly initialized? (Choose two.)

A.
em.merge(order);
em.flush();

B.
em.persist(order);
em.flush();

C.
em.joinTransaction();
em.persist(order);

D.
em = emf.createEntityManager();
em.persist(order);



Leave a Reply 0

Your email address will not be published. Required fields are marked *