Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var session = appComponent.sessionFactory.openSession()
- var transaction: Transaction? = null
- try {
- transaction = session.beginTransaction()
- session.get(MailPatternEntity::class.java, 1)
- transaction.commit()
- } catch (exception: RuntimeException) {
- transaction?.rollback()
- exception.printStackTrace()
- } finally {
- session.close()
- }
- session = appComponent.sessionFactory.openSession()
- try {
- transaction = session.beginTransaction()
- val entity = MailPatternEntity(1, htmlText = "some text")
- session.saveOrUpdate(entity)
- transaction.commit()
- } catch (exception: RuntimeException) {
- transaction?.rollback()
- exception.printStackTrace()
- } finally {
- session.close()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement