This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A Java Persistence application uses the EntityManager.flush method to synchronize the current persistence context with the database. Which two statements are correct? (Choose two.)
A. The flush method might cause the persist operation to be cascaded to related entities. B. Extensive use of the flush method decreases the performance of a Java Persistence application. C. The flush method should be used to synchronize the current persistence context with modifications made in other transactions. D. The flush method should be used to publish changes done in the current persistence context to other transactions before actual transaction commit
What should the answers be ? Should'nt one of them be option D?? Please explain as to why you chose your options...
Hi, the flush operation makes effective any pending entity manager operation. But if you are working into a transaction, that effectiveness is not seen by other transactions until commit. I would exclude the C option, too for obvious reasons.