A developer is creating a long-running Java Persistence reporting application that accesses a set
of related entities. The application is NOT expected to add, change, or remove records in the
database but the data can be changed by another application running on the same database.
Which option will guarantee that the report does NOT contain stale data?
A.
CalltheEntityManagerflush API before preparing the report.
B.
CalltheEntityManager createOueryAPIbeforepreparingthe report.
C.
Call the EntityManager clearAPIbefore accessing thefieldsor properties of the entities used in
the report.
D.
CalltheEntityManager refresh on each parent entity that is added to the report, and specify
cascade=REFRESH onallcorresponding relationships.
Explanation: