开发者

Hibernate session.beginTransaction() call and Mysql Start Transaction

开发者 https://www.devze.com 2023-02-10 17:29 出处:网络
When I issue the command session.beginTransaction(); // do something session.getTransaction().commit(); I don\'t see a corresponding Start Transaction c开发者_StackOverflow社区ommand issue to my da

When I issue the command

session.beginTransaction();
// do something
session.getTransaction().commit();

I don't see a corresponding Start Transaction c开发者_StackOverflow社区ommand issue to my database. Can any body explain to why it is not there and how mysql knows the boundary of a transaction.

Thanks,


As briefly mentioned in the Hibernate Developer Guide, JDBC does not define an explicit method for beginning a transaction. The Java JDBC Tutorial mentions disabling auto-commit mode to be able to group two or more statements into a transaction. This is exactly what Hibernate does in the session.beginTransaction() call.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号