提交 1e59d20f authored 作者: 陈世营's avatar 陈世营

base transaction

上级 b6dfbdf4
......@@ -3,6 +3,7 @@ package com.loit.shardingsphere.seata.nacos.feign.modules.service.impl;
import com.loit.shardingsphere.seata.nacos.feign.modules.entity.OrderEntity;
import com.loit.shardingsphere.seata.nacos.feign.modules.service.IBusinessService;
import com.loit.shardingsphere.seata.nacos.feign.modules.service.IOrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.apache.shardingsphere.transaction.annotation.ShardingTransactionType;
import org.apache.shardingsphere.transaction.core.TransactionType;
import org.apache.shardingsphere.transaction.core.TransactionTypeHolder;
......@@ -22,14 +23,13 @@ public class BusinessServiceImpl implements IBusinessService {
* @param userId
*/
@Override
@ShardingTransactionType(TransactionType.LOCAL)
//@GlobalTransactional
@Transactional
@ShardingTransactionType(TransactionType.BASE)
@GlobalTransactional
public void purchase(Long userId) {
if (userId == null) {
return;
}
TransactionTypeHolder.set(TransactionType.LOCAL);
TransactionTypeHolder.set(TransactionType.BASE);
OrderEntity orderEntity = new OrderEntity();
orderEntity.setOrderId(userId);
orderEntity.setStatus("seata");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论