Quote:
Does hibernate send everything to the DB at commit? (I assume that is when it flushes be default unless you otherwise say so to Hibernate right?)
Flushing can happen at other times also (eg. before executing a query). You can change the default by specifying a different FlushMode. See
http://docs.jboss.org/hibernate/stable/ ... e-flushing for more information.
Quote:
So if the above is true and commit fails, rollback will obviously fail also cause the DB is still disconnected. But what happens to the begin transaction in the database?
The database should of course detect this and rollback anything that has already been sent in that transaction. This assumes that you are using a database that does support transactions. One exception is MySQL with the MyISAM engine.