before calling session.gettransaction, do I have to ensure one exists?
if so, how do I check if there is a current uncommitted transaction in the session?
before calling session.gettransaction, do I have to ensure one exists?
if so, how do I check if there is a current uncommitted transaction in the session?
No, you do not have to check. Session.getTransaction
will initiate a new transaction if a current one does not exist.
See source code for SessionImpl.getTransaction
and JDBCContext.getTransaction
.