jdbc - Is it mandatory to close transaction each time in Hibernate? -


in hibernate close session each time necessary close transaction each time in hibernate or transaction commit sufficient?

we can begin , commit or rollback transaction . , closing transaction ambiguous me . mean commit or rollback transaction ?

if transaction begins , database connection established between client , server . connection released if transaction committed , roll-backed or time-out (if database supports it) .

calling session.close() call java.sql.connection#close() . according jdbc specification , if java.sql.connection#close() called , there active transaction, result of active transaction depends on jdbc vendor 's implementation. in case of postgresql, automatically rollback . recommended application explicitly commits or rolls active transaction prior session.close()


Comments