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.
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)- A4% (2)
- B84% (43)
- C2% (1)
- D10% (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
Community Discussion
No community discussion yet for this question.