@TransactionalpublicinttestSave(){
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}
@Transactional(rollbackFor = Exception.class)publicinttestSave(){
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}
case3 没有加 rollbackFor = Exception.class 事务没有回滚
@TransactionalpublicinttestSave(){
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
// TODO: handle exception}return0;}
publicinttestSave()throws Exception {
returntestSave2();}@Transactional(rollbackFor = Exception.class)publicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case7 事务没有回滚
@TransactionalpublicinttestSave()throws Exception {
returntestSave2();}@Transactional(rollbackFor = Exception.class)publicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case8 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
returntestSave2();}publicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case9 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
returntestSave2();}@Transactional(rollbackFor = Exception.class)publicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case10 事务未回滚
@TransactionalpublicinttestSave()throws Exception {
returntestSave2();}@Transactional(rollbackFor = Exception.class)publicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case11 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
returntestSave2();}@TransactionalpublicinttestSave2()throws Exception {
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());thrownewException(e.getMessage());}}
case12 事务未回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
returntestSave2();}@TransactionalpublicinttestSave2(){
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);int m =1/0;return1;}catch(Exception e){
System.out.println(e.getMessage());}return0;}
case13 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
int m =testSave2();int n =1/0;return m;}@TransactionalpublicinttestSave2(){
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);return1;}catch(Exception e){
System.out.println(e.getMessage());}return0;}
case14 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
int m =testSave2();int n =1/0;return m;}publicinttestSave2(){
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);return1;}catch(Exception e){
System.out.println(e.getMessage());}return0;}
case15 事务回滚
@Transactional(rollbackFor = Exception.class)publicinttestSave()throws Exception {
int m =testSave2();int n =1/0;return m;}@Transactional(rollbackFor = Exception.class)publicinttestSave2(){
try{
User user =newUser();
user.setName("岳不群2");
user.setAge(70);
user.setEmail("[email protected]");
userMapper.insert(user);return1;}catch(Exception e){
System.out.println(e.getMessage());}return0;}