`

Application exception overridden by commit exception

阅读更多
 ERROR TransactionInterceptor:307 - Application exception overridden by commit exception
错误原因可能为:
Remember only unchecked exceptions cause rollbacks in spring transactions.

What is happening is that you're catching the unchecked exception, converting it to a checked exception and then propogating it. The transaction manager does not rollback for RecordExistsException and thinks that your first transaction has succeded. Thats why it tries to save your child objects. You should annotate your service with 
Code:
@Transactional (rollbackFor= RecordExistsException.class)
or have your exception class extend RuntimeException.
解决办法:
OK, the way I read that an exception occurs and it does indeed do a commit. I would presume there must be a rollback rule defined telling it to do this.

Before Spring2.0 might look like this.

<prop key="*">PROPAGATION_REQUIRED, -com.mydomain.exception.MyException</prop>


http://www.springframework.org/docs/reference/transaction.html#transaction-declarative-txadvice-settings
分享到:
评论

相关推荐

    spring-dubbo-spring-boot.rar_java编程_spring_spring boot_threwwab_

    《Spring Dubbo与Spring Boot整合应用详解》 在现代企业级开发中,Spring框架和其衍生的Spring Boot已经成为Java开发者的重要工具。同时,随着微服务架构的流行,Dubbo作为一款高效率的服务治理框架,也得到了广泛...

    javafx-8u152-apidocs-api

    Note that the start method is abstract and must be overridden. The init and stop methods have concrete implementations that do nothing. Calling Platform.exit() is the preferred way to explicitly ...

    C院Java常用单词

    40. **Overridden method**:重写方法是指子类重新定义父类中的方法,保持相同的签名但可能有不同的实现。 41. **Abstract**:抽象类是包含抽象方法的类,不能实例化,只能被继承。 42. **Interface**:接口是包含...

    微软内部资料-SQL性能优化3

    Application A lock resource defined by an application. The lock manager knows nothing about the resource format. It simply compares the 'strings' representing the lock resources to determine whether ...

    VC帮助文档

    Public and protected class members are documented only when they are normally used in application programs or derived classes. Occasionally, private members are listed because they override a public ...

    Java编程常用单词.pdf

    Java的API(Application Programming Interface)提供了一系列预先定义好的类和接口,如集合(Collection)接口,它允许开发者管理和操作数据集合。容器(Container)类如JFrame或JPanel,用于构建GUI(Graphics ...

    Java选择题.pdf

    构造方法在Java中用于初始化新创建的对象,它们不能被重写(overridden),但可以被重载(overloaded)。选项A正确,B、C、D错误。重写是指子类提供与父类相同名称和参数列表的方法,但具有不同的实现;而重载则是在...

    编程英语词汇

    异常处理相关的英语词汇有:Exception(异常)、Runtime Exception(运行时异常)、ArithmeticException(算术异常)、IllegalArgumentException(非法参数异常)、ArrayIndexOutOfBoundsException(数组索引越界...

    servlet2.4doc

    Notification that the web application initialization process is starting. Cookie - class javax.servlet.http.Cookie. Creates a cookie, a small amount of information sent by a servlet to a Web browser,...

    USB短信猫驱动

    The device can be installed with ResetPipeRequestRetryCount set to any value by changing FTDIBUS.INF as shown in the following fragment. [FtdiBus_AddService.AddReg] HKR,Parameters,"RetryResetCount",...

    eclipse 插件org.apache.axis2.eclipse.service.plugin_1.7.8

    eclipse 4.9.0 插件org.apache.axis2.eclipse.service.plugin_1.7.8

    .Net经典面试33条题及答案

    8. **Error与Exception**:Error通常代表系统级别的问题,可能难以恢复,而Exception是程序运行时可预见的异常,可以通过异常处理机制进行处理。 9. **final, finally, finalize的区别**:final用于声明不可更改的...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: In the method TFlexPanel.ResizeSelection exception occurred when the number of selected items changed while the method was running. - ADD: Added the method TFlexControl.DoNeedHint - allows ...

    Xcode_Build_Setting_Reference

    This setting defines the device family targeted by the application. It can include iPhone, iPad, or both. Specifying the targeted device family helps ensure that the application is optimized for the ...

    ObjCRuntimeGuide

    Methods such as `description`, `isEqual:`, and `hash` are provided by `NSObject` and can be overridden by subclasses. ##### Runtime Functions Runtime functions allow developers to perform low-level...

    vp_color_table.rar_esprit_lynx prime_objects_vertex array

    The color tracking is enabled so that our material diffuse colors are overridden by our vertex colors. To do this we ll enable the "All Geometries Lit" and "Use Material Diffuse Color" options in the...

    java常用英语单词(1)

    23. **Extends, Base class, Super class, Overloaded method, Overridden method**:继承、基类、超类、方法重载和方法重写,是面向对象的特性。 24. **Public, Private, Protected, Static, Abstract, Interface,...

    编程英语词汇.pdf

    Exception是程序运行时发生的不正常情况的类,包括Runtime Exception(运行时异常)、Arithmetic Exception(算术异常)、IllegalArgumentException(非法数据异常)等。异常处理的关键字有try、catch、finally、...

    Delphi7.1 Update

    * Setting MTSDataModule.AutoComplete to False in the IDE is overridden and set back to True at run time (Quality Central 4716).* Calls to ApplyUpdates(-1) on a TMTSDataModule do not work properly ...

    jdk1.6与jboss5.x冲突问题的解决方法

    描述中提到的问题是尝试在后台声明一个Web服务,但在前台调用时抛出了`java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage`的异常。这通常意味着在处理...

Global site tag (gtag.js) - Google Analytics