草庐IT

revert回滚

全部标签

spring - Spring JDBC 测试的事务回滚

我试图在使用Spring-test时回滚JDBC事务但没有成功。当我运行以下SQL更新总是提交。packagemy.dao.impl;importorg.junit.Test;importorg.junit.runner.RunWith;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.test.annotation.Rollback;importorg.springframework.test.context.ContextConfiguration;impor

spring - Spring JDBC 测试的事务回滚

我试图在使用Spring-test时回滚JDBC事务但没有成功。当我运行以下SQL更新总是提交。packagemy.dao.impl;importorg.junit.Test;importorg.junit.runner.RunWith;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.test.annotation.Rollback;importorg.springframework.test.context.ContextConfiguration;impor

java - Spring 3/Hibernate 中回滚事务的最佳实践

引用Springdocumentation:AnyRuntimeExceptionwilltriggerrollback,andanycheckedExceptionwillnot引用javapractices.comUncheckedexceptions:represent defectsintheprogram(bugs) -ofteninvalidargumentspassedtoanon-privatemethod.Toquotefrom TheJavaProgrammingLanguage,byGosling,Arnold,andHolmes:"Uncheckedruntim

java - Spring 3/Hibernate 中回滚事务的最佳实践

引用Springdocumentation:AnyRuntimeExceptionwilltriggerrollback,andanycheckedExceptionwillnot引用javapractices.comUncheckedexceptions:represent defectsintheprogram(bugs) -ofteninvalidargumentspassedtoanon-privatemethod.Toquotefrom TheJavaProgrammingLanguage,byGosling,Arnold,andHolmes:"Uncheckedruntim

hibernate - 如何在集成测试中使用 Propagation.REQUIRES_NEW 回滚嵌套事务

我有几个针对扩展以下基类的各种服务的集成测试:@ContextConfiguration(locations="classpath:applicationContext-test.xml")@TransactionConfiguration(transactionManager="txManager",defaultRollback=true)@TransactionalpublicabstractclassIntegrationTestBaseextendsAbstractTransactionalJUnit4SpringContextTests{//Somesetup,fillin

hibernate - 如何在集成测试中使用 Propagation.REQUIRES_NEW 回滚嵌套事务

我有几个针对扩展以下基类的各种服务的集成测试:@ContextConfiguration(locations="classpath:applicationContext-test.xml")@TransactionConfiguration(transactionManager="txManager",defaultRollback=true)@TransactionalpublicabstractclassIntegrationTestBaseextendsAbstractTransactionalJUnit4SpringContextTests{//Somesetup,fillin

ruby-on-rails - 如果 API 调用失败,我该如何回滚事务,反之亦然?

我想要两件事:a)我希望仅当API调用成功时才能够在数据库中保存一条记录b)我只想在数据库记录成功保存时执行API调用目标是使存储在本地(在数据库中)的数据与Stripe上的数据保持一致。@payment=Payment.new(...)beginPayment.transactiondo@payment.save!stripe_customer=Stripe::Customer.retrieve(manager.customer_id)charge=Stripe::Charge.create(amount:@plan.amount_in_cents,currency:'usd',cu

c# - FluentMigrator 回滚到不可空列?

给定以下迁移:[Migration(1)]publicclassMig001:Migration{publicoverridevoidUp(){Alter.Table("foo").AlterColumn("bar").AsInt32().Nullable();}publicoverridevoidDown(){Alter.Table("foo").AlterColumn("bar").AsInt32().NotNullable();}}迁移器更改列并使其可为空,在回滚时它会执行相反的操作并再次使其不可为空。假设自迁移以来数据已添加到foo;bar列中现在有空行。如果回滚那么操作就会失

java - JUnit 测试总是回滚事务

我正在对应用程序DAO运行一个简单的JUnit测试。问题是我总是得到:javax.persistence.RollbackException:TransactionmarkedasrollbackOnlyJUnit测试是:@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={"classpath:com/my/app/context.xml"}@TransactionConfiguration(transactionManager="transactionManager",defaultRollb

java - JUnit 测试总是回滚事务

我正在对应用程序DAO运行一个简单的JUnit测试。问题是我总是得到:javax.persistence.RollbackException:TransactionmarkedasrollbackOnlyJUnit测试是:@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={"classpath:com/my/app/context.xml"}@TransactionConfiguration(transactionManager="transactionManager",defaultRollb