javax.jdo.Transaction.setRollbackOnly()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(155)

本文整理了Java中javax.jdo.Transaction.setRollbackOnly()方法的一些代码示例,展示了Transaction.setRollbackOnly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.setRollbackOnly()方法的具体详情如下:
包路径:javax.jdo.Transaction
类名称:Transaction
方法名:setRollbackOnly

Transaction.setRollbackOnly介绍

[英]Sets the rollback-only status of the transaction to true. After this flag is set to true, the transaction can no longer be committed, and any attempt to commit the transaction will throw JDOFatalDataStoreException[[$2$]]
[中]将事务的仅回滚状态设置为true。此标志设置为true后,事务将无法再提交,任何提交事务的尝试都将抛出JDOFatalDataStoreException[[$2$]]

代码示例

代码示例来源:origin: apache/servicemix-bundles

public void setRollbackOnly() {
  Transaction tx = this.persistenceManagerHolder.getPersistenceManager().currentTransaction();
  if (tx.isActive()) {
    tx.setRollbackOnly();
  }
  if (hasConnectionHolder()) {
    getConnectionHolder().setRollbackOnly();
  }
}

代码示例来源:origin: apache/incubator-sentry

Transaction transaction = pm.currentTransaction();
transaction.begin();
transaction.setRollbackOnly();  // Makes the tx read-only
Query query = pm.newQuery("javax.jdo.query.SQL", privFilter);
query.setClass(MSentryPrivilege.class);

相关文章