When we are updating a record, we can use session.flush() with Hibernate. What\'s the need for flush()?
Flushing the Session gets the data that is currently in the session synchronized with what is in the database.
More on the Hibernate website:
flush() is useful, because there are absolutely no guarantees about when the Session executes the JDBC calls, only the order in which they are executed - except you use flush().