| | |
| | | package com.yeshi.buwan.service.manager; |
| | | |
| | | import com.ks.goldcorn.exception.GoldSourceException; |
| | | import com.ks.goldcorn.pojo.DO.GoldCornGetSource; |
| | | import com.ks.goldcorn.service.remote.GoldCornGetSourceService; |
| | | import com.yeshi.buwan.dao.user.LoginUserDao; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import io.seata.core.context.RootContext; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.orm.hibernate4.HibernateCallback; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class SeataManagerTest { |
| | |
| | | @Resource |
| | | private LoginUserDao loginUserDao; |
| | | |
| | | @Reference(version = "1.0") |
| | | @Reference(version = "1.0",check = false) |
| | | private GoldCornGetSourceService goldCornGetSourceService; |
| | | |
| | | @GlobalTransactional(timeoutMills = 30000, name = "buwan-order", rollbackFor = Exception.class) |
| | | public void addGetResource() throws Exception { |
| | | // loginUserDao.selectByPrimaryKeyForUpdate("50134"); |
| | | System.out.println("开始全局事务,XID = " + RootContext.getXID()); |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setId("50134"); |
| | | loginUser.setName("test3"); |
| | | loginUser.setName("test9"); |
| | | loginUserDao.updateSelective(loginUser); |
| | | |
| | | GoldCornGetSource get = new GoldCornGetSource(); |
| | | get.setAppId(15L); |
| | | get.setSourceCode("test1"); |
| | | get.setSourceCode("test5"); |
| | | get.setSourceName("测试"); |
| | | get.setGoldCorn(1); |
| | | |