I have the following piece of code that inserts or updates a bean in the database.
I have a static function in the HibernateUtil
that returns a singleton instance from the Hibernate session.
hibSession = HibernateUtil.currentSession();
hibSession.saveOrUpdate(bean);
hibSession.flush();
This is existing code, I am wondering if there is any reason that make the programmer use flush instead of simply committing and what flush does exactly.