nerdexam
Oracle

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.

EntityManager Operations

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)
  • A
    81% (13)
  • B
    13% (2)
  • D
    6% (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

#EntityManager.refresh#entity state#database synchronization#cache

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice