Multiple choice technology packaged enterprise solutions

What Session.flush() do ?

  1. the state of that object will be synchronized with the database.

  2. the state of that object will be synchronized with the SessionFactory.

  3. remove state of that object from Session.

  4. remove state of that object from SessionFactory.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Session.flush() synchronizes the in-memory state of persistent objects with the database. It executes SQL statements (INSERT, UPDATE, DELETE) to make the database reflect the changes made to objects in the Hibernate Session, but doesn't commit the transaction - use commit() for that.