expertPersistence Context & Dirty Checking

Why might you deliberately set FlushMode.COMMIT instead of the default AUTO?

To avoid the (sometimes surprising) performance cost of automatic pre-query flushes when you know your queries don't need to see not-yet-flushed pending changes — trading a small correctness convenience for predictable, batched flush timing.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What are the four entity states in JPA?← Back to all Transaction Mastery questions