When managing transactions, you can call begin, commit, and rollback methods on a Hibernate object.
当管理事务的时候,您可以在Hibernate对象上调用开始、提交以及回滚方法。
In this technique, you would set the autoCommit property on the connection object to false and manually commit or roll back the connection. Listing 2 illustrates this technique.
在此技巧中,您将Connection对象上的autocommit属性设置为false,并手动提交或回滚连接。
In this case, you must invoke the commit method on the Connection object if all is well; otherwise, invoke the rollback method if an exception occurs.
在本例中,如果一切正常,您必须调用Connection对象上的commit方法;否则,如果出现异常,则调用rollback方法。
应用推荐