Open liju023 opened 5 years ago
package com.demo.service.impl;
import com.demo.dao.TestDao; import com.demo.entity.Test; import com.demo.service.Test2Service; import com.demo.service.TestService; import com.codingapi.tx.annotation.TxTransaction;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
/**
Created by lorne on 2017/6/7. */ @Service public class TestServiceImpl implements TestService {
@Autowired private TestDao testDao;
@Autowired private Test2Service test2Service;
@Override @TxTransaction(isStart = true) @Transactional public String hello() { //远程调用 String res1 = test2Service.test();
//本地执行 String name = "mybatis_demo1"; Test test = new Test(); test.setName(name); testDao.save(test); try { TimeUnit.MINUTES.sleep(1L); } catch (InterruptedException e) { e.printStackTrace(); }
// int v = 100/0; //1> 20 ; 2> 22;
return res1; }
}
这个是不是我配置有问题?还是怎么回事呢?
日志 参与方:lcn transaction over, res -> groupId:9qjLxkPZ and state is rollback 发起方: lcn start transaction over, res -> groupId:9qjLxkPZ and state is commit
package com.demo.service.impl;
import com.demo.dao.TestDao; import com.demo.entity.Test; import com.demo.service.Test2Service; import com.demo.service.TestService; import com.codingapi.tx.annotation.TxTransaction;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
/**
Created by lorne on 2017/6/7. */ @Service public class TestServiceImpl implements TestService {
@Autowired private TestDao testDao;
@Autowired private Test2Service test2Service;
@Override @TxTransaction(isStart = true) @Transactional public String hello() { //远程调用 String res1 = test2Service.test();
// int v = 100/0; //1> 20 ; 2> 22;
}