当前位置:
代码迷
>>
综合
>> 事务注解 @Transactional(rollbackFor = Exception.class) 为什么写rollbackFor = Exception.class
详细解决方案
事务注解 @Transactional(rollbackFor = Exception.class) 为什么写rollbackFor = Exception.class
热度:
88
发布时间:
2023-11-18 08:29:12.0
正文
在@Transactional注解中
如果不配置rollbackFor属性,那么事务只会在遇到运行时异常 RuntimeException(如 NullPointerExcepton 等 )、Error 的时候才会回滚,
加上rollbackFor=Exception.class,可以让事务在遇到检查异常 checked exceptions(如 IOException 异常)时也回滚
扩展
非检查异常与检查异常
运行时异常与非运行时异常|
查看全文
相关解决方案
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml解决办法
Class not found: com.mchange.v2.c3p0.ComboPooledDataSource,该怎么处理
大神们开始觅错啦!org.hibernate.exception.SQLGrammarException: could not execute query
org.apache.jasper.JasperException: Unable to compile class for JSP:该怎么解决
org.apache.jasper.JasperException: Unable to compile class for JSP:解决思路
struts2 exception,该怎么解决
GWT 报错,能的请进: com.google.gwt.event.shared.UmbrellaException: Exception caught: Se
!使用JDNI时,报 Cannot create JDBC driver of class '' for connect URL 'null'
Unable to load class for JSP,该如何处理
新手Dialect class not found
Caused by: org.hibernate.MappingException: Association references un地图ped class: com.elone.pm.product.dao.TAttribute
Exception loading sessions from persistent storage,该怎么解决
Error creating bean with name 'sessionFactory' defined in class path resource解决方法
Unable to compile class for JSP找不出异常
Could not load JDBC driver class 咋回事
No setter found for property 'sessionFactoroy' in class 'com.iBBS.dao.impl.UserI解决思路
getHibernateTemplate().get(entity.Class,serializabel id) 如何报java.lang.NullPointerException的错误
呀javax.servlet.ServletException: Servlet execution threw an exception
小弟我在tomcat里的Server.xml部署web项目报Error instantiating servlet class
Exception in thread "main" java.lang.UnsupportedClassVersionError:有关问题
null id in com.bsw.gms.hibernate.pojo.Score entry (don't flush the Session after an exception occurs,该怎么解决
Jsp + Oracle 怎么取回id,报错getInt not implemented for class oracle.jdbc.driver.T4CRo
紧急 Exception starting filter struts2
ssh项目hibernate 异常:org.hibernate.MappingException: Association references unmapped class: Message
java.lang.NoClassDefFoundError: Could not initialize class cn.elvis.utils.JdbcUt,该如何处理
Cannot load JDBC driver class 'com.microsoft.jdbc.sqlserver.SQLServerDriver'解决方法
class path resource [applicationContext.xml] does not exist解决方法
org.hibernate.exception.SQLGrammarException: could not execute query有关问题求解
SEVERE: Exception starting filter struts2,该怎么处理
Cause: java.sql.SQLException: 关闭的连接]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException解决思路