I have checked the sources of NHibernate 3.1.0
and it seems that calling the ISession.Close()
should result in a ITransaction.Dispose()
for the default implementation. But nevertheless using that in an existing application did not result in a explicit transaction commit
or rollback
- checked with the NHibernate Profiler
.
I don't think it is a good idea to leave the transaction to rely only on the ISession.Close()
as it can lead to unpredictable behaviors. What if someone will adapt that particular method and include the ISession.SaveOrUpdate
... your entities will not get persisted.
UPDATE:
From the Sql Server
perspective I think it depends on your transaction isolation level
but I'm pretty sure that sooner or later you will encounter locks or timeouts. Please refer to this sql-server
specific question:
What happens to an uncommitted transaction when the connection is closed?