Home > Back-end >  For help, spring integration mybatis can't control the transaction rolled back
For help, spring integration mybatis can't control the transaction rolled back

Time:09-17

In service type of method of saveAccount intentionally throws the exception, but the database will be normal insert the record, not a rollback, bosses, please help to see where in addition to the problem, thank you! The code is as follows:
service categories:
 
@ Service (" accountService ")
Public class AccountServiceImpl implements AccountService {

The @autowired
Private AccountDao AccountDao;

@ Override
Public List The.findall () {
System. The out. Println (" the business layer the.findall () ");
Return accountDao. The.findall ();
}

@ Override
Public void saveAccount Account (Account) throws RuntimeException {

System. The out. Println (" the business layer saveAccount () ");
AccountDao. SaveAccount (account);
Throw new RuntimeException (" wrong ");
}
}


spring configuration file:
 
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: aop="http://www.springframework.org/schema/aop"
XMLNS: tx="http://www.springframework.org/schema/tx"
Xsi: schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd "& gt;

















for springmvc configuration:
 
<? The XML version="1.0" encoding="utf-8"?>
XMLNS: MVC="http://www.springframework.org/schema/mvc"
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd "& gt;




  • Related