Which method of the EntityManager interface should the new code use to ensure that the data read by JDBC statements includes the state of managed entities?

A developer is modifying an existing Java EE application that uses the JDBC API to access a
database. This code must be used but cannot be changed, and new code needs to be added that
uses the Java Persistence API.
Both parts of the code will execute in the same JTA transaction.
Which method of the EntityManager interface should the new code use to ensure that the data
read by JDBC statements includes the state of managed entities?

A developer is modifying an existing Java EE application that uses the JDBC API to access a
database. This code must be used but cannot be changed, and new code needs to be added that
uses the Java Persistence API.
Both parts of the code will execute in the same JTA transaction.
Which method of the EntityManager interface should the new code use to ensure that the data
read by JDBC statements includes the state of managed entities?

A.
Call refresh on eachchangedentity.

B.
Callflushatthe end of each business method.

C.
Call find before accessing any managed entity.

D.
Calllockatthe beginning of each business method.



Leave a Reply 0

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