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.