nerdexam
Oracle

1Z0-898 · Question #56

An application creates a TypedQuery object to perform a query, and sets the query object's flush mode by calling setFlushMode (FlushModeType.commit). The query is executed within a transaction…

The correct answer is B. Updates to the entities that can affect the outcome of the query cannot be flushed to the database. If FlushModeType.COMMIT is set, the effect of updates made to entities in the persistence context upon queries is unspecified. COMMIT:Flushing to occur at transaction commit. AUTO:(Default) Flushing to occur at query execution.

EntityManager Operations

Question

An application creates a TypedQuery object to perform a query, and sets the query object's flush mode by calling setFlushMode (FlushModeType.commit). The query is executed within a transaction. Which of the following is true?

Options

  • AUpdates to the database tables may occur anytime during the transaction associated with the
  • BUpdates to the entities that can affect the outcome of the query cannot be flushed to the database
  • CChanges to the entities in this transaction cannot be flushed to the database until the transaction
  • DsetFlushMode cannot be called on a TypedQuery object.

How the community answered

(51 responses)
  • A
    4% (2)
  • B
    84% (43)
  • C
    2% (1)
  • D
    10% (5)

Explanation

If FlushModeType.COMMIT is set, the effect of updates made to entities in the persistence context upon queries is unspecified. COMMIT:Flushing to occur at transaction commit. AUTO:(Default) Flushing to occur at query execution.

Topics

#FlushModeType#TypedQuery#transaction flush#COMMIT flush mode

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice