Created
December 30, 2019 07:11
-
-
Save kubawieczorek/1414568ea1acf956731a8ee33be3bae2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Transaction tx = null; | |
try { | |
tx = session.beginTransaction(); | |
// do some work | |
tx.commit(); | |
} | |
catch (RuntimeException e) { | |
if (tx != null) tx.rollback(); | |
throw e; | |
} | |
finally { | |
session.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment