QuizzesDirty Checking — Concept Check
intermediate
hibernate

Dirty Checking — Concept Check

Questions on Dirty Checking. Hibernate tracks managed entity snapshots; on flush it compares current state with the snapshot and issues UPDATE for changed fields — understand this to avoid unexpected SQL statements.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Dirty Checking — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer notices that an UPDATE statement includes all columns even if only one field was changed. What Hibernate feature could optimize this?

    • A@DynamicInsert
    • B@Immutable
    • CRead-only session
    • D@DynamicUpdate
  2. 2.In a @Transactional method, a product's price is updated but no explicit save() is called. What happens when the method exits?

    • AAn exception is thrown for missing save()
    • BThe entity becomes detached and changes are lost
    • CNo changes are persisted without save()
    • DHibernate issues an UPDATE for the changed fields
  3. 3.A developer uses @Immutable on an entity. What is the implication for dirty checking?

    • ANo UPDATE/DELETE is generated for the entity
    • BOnly dirty fields are updated
    • CAll fields must be updated manually
    • DThe entity cannot be queried
  4. 4.Why might using @DynamicUpdate be beneficial for entities with many columns?

    • AIt reduces the number of columns in UPDATE statements
    • BIt requires explicit save() calls
    • CIt forces all columns to be updated
    • DIt disables dirty checking
  5. 5.A product entity is loaded, modified, and then the method returns without a transaction. What happens to the changes?

    • AChanges are persisted automatically
    • BChanges are lost as the entity is detached
    • CAn exception is thrown
    • DChanges are queued for later persistence
  6. 6.Which Hibernate feature skips snapshot creation to improve performance for read-only queries?

    • A@DynamicUpdate
    • B@Immutable
    • C@DynamicInsert
    • DRead-only session
  7. 7.A developer believes calling save() on a managed entity persists changes. Why is this incorrect?

    • Asave() is required for persistence
    • Bsave() detaches the entity
    • Csave() throws an exception for managed entities
    • DManaged entities are automatically updated on flush
  8. 8.What happens if a field in a managed entity is mutated within a @Transactional method?

    • AAn exception is thrown
    • BHibernate detects the change and issues an UPDATE
    • CThe change is ignored
    • DThe entity becomes detached