Transaction in Hibernate

Session session = null;
Transaction tx = null;
try {
session = sessionFactory.openSession();
tx = session.beginTransaction();
Query update = session.createSQLQuery("update User set username='XYZ' where userid=123");
update.executeUpdate();
tx.commit();
} catch (Exception e) {
tx.rollback();
} finally {
session.close();
}



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules, and is considered as spam.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.26
TRX 0.20
JST 0.038
BTC 96220.81
ETH 3675.45
USDT 1.00
SBD 3.90