0

Directly from this API:

Savepoint setSavepoint(String name) throws SQLException

Creates a savepoint with the given name in the current transaction and returns the >new Savepoint object that represents it.

if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created savepoint.

It's not clear to me the last part:

"if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly created savepoint"?

Outside an active transaction? what do they mean by that?

4

1 回答 1

1

JDBC 规范详细说明了何时启动事务(例如,当执行语句并且没有活动事务时)以及应该何时结束(在提交、回滚时,或者 - 当启用自动提交时 - 语句完成后(执行后) ,或检索结果集的最后一行)或执行另一条语句时。

您引用的 api 文档仅意味着当您调用setSavePoint()并且没有事务处于活动状态时,驱动程序将启动事务(假设支持保存点)并且将创建保存点。

于 2013-09-06T14:35:32.333 回答