1Z0-898 · Question #17
A developer wants to ensure that an entity's data is up-to-date with regard to the database. Which of the following statements is guaranteed to accomplish this?
The correct answer is A. Call EntityManager.refresh on the entity. refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties) Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any.
Question
A developer wants to ensure that an entity's data is up-to-date with regard to the database. Which of the following statements is guaranteed to accomplish this?
Options
- ACall EntityManager.refresh on the entity.
- BAdd acacheable (false) annotation on the entity class.
- CCall EntityManager.find on the entity.
- DUse a named query to retrieve the entity.
How the community answered
(16 responses)- A81% (13)
- B13% (2)
- D6% (1)
Explanation
refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties) Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any.
Topics
Community Discussion
No community discussion yet for this question.