Comments (10)
@GlobalTransactional
@Override
public void stockChange(List<StockDTO> stockDTOList, Boolean flag) {
List<StockEntity> list = new ArrayList<>();
for (StockDTO stockDTO : stockDTOList) {
LambdaQueryWrapper<StockEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StockEntity::getProductId, stockDTO.getProductId());
StockEntity stockEntity = super.getOne(wrapper);
if (Objects.isNull(stockEntity)) {
throw new BizException(ResultCode.PRODUCT_NOT_FOUND);
}
Integer stock = stockEntity.getStock();
Integer resultStock = flag ? stock + stockDTO.getNumber() : stock - stockDTO.getNumber();
stockEntity.setStock(resultStock);
list.add(stockEntity);
}
if (CollUtil.isNotEmpty(list)) {
super.saveOrUpdateBatch(list);
}
throw new BizException(ResultCode.FILE_SIZE_TOO_BIG_ERROR);
}
from incubator-seata.
@ResponseStatus(HttpStatus.OK)
@ExceptionHandler(value = Exception.class)
public ApiResult handleException(Exception exception) {
return ApiResult.failed(ResultCode.FAILED.getCode(), exception.getCause().getMessage());
}
from incubator-seata.
@ResponseStatus(HttpStatus.OK)
@ExceptionHandler(BizException.class)
public ApiResult handleRRException(BizException exception) {
return ApiResult.failed(exception.getCode(), exception.getMessage());
}
// 这里的BizException被handleException(Excetion)捕获了
from incubator-seata.
Only 2.0 is a runtimeException, check for dependency conflicts
from incubator-seata.
from incubator-seata.
@funky-eyes 下一个版本会修复此问题么
from incubator-seata.
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<version>2.2.6.RELEASE</version>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
from incubator-seata.
seata:
enabled: true
application-id: ${spring.application.name}
tx-service-group: my_test_tx_group
enable-auto-data-source-proxy: true
use-jdk-proxy: false
#excludes-for-auto-proxying: firstClassNameForExclude,secondClassNameForExclude
client:
rm:
async-commit-buffer-limit: 1000
report-retry-count: 5
table-meta-check-enable: false
report-success-enable: false
saga-branch-register-enable: false
lock:
retry-interval: 10
retry-times: 30
retry-policy-branch-rollback-on-conflict: true
tm:
degrade-check: false
degrade-check-period: 2000
degrade-check-allow-times: 10
commit-retry-count: 5
rollback-retry-count: 5
undo:
data-validation: true
log-serialization: jackson
log-table: undo_log
only-care-update-columns: true
log:
exceptionRate: 100
service:
vgroup-mapping:
my_test_tx_group: default
grouplist:
default: 127.0.0.1:8091
enable-degrade: false
disable-global-transaction: false
transport:
shutdown:
wait: 3
thread-factory:
boss-thread-prefix: NettyBoss
worker-thread-prefix: NettyServerNIOWorker
server-executor-thread-prefix: NettyServerBizHandler
share-boss-worker: false
client-selector-thread-prefix: NettyClientSelector
client-selector-thread-size: 1
client-worker-thread-prefix: NettyClientWorkerThread
worker-thread-size: default
boss-thread-size: 1
type: TCP
server: NIO
heartbeat: true
serialization: seata
compressor: none
enable-client-batch-send-request: true
config:
type: nacos
nacos:
namespace: "dev"
serverAddr: xxxxxxxx:8848
group: SEATA_GROUP
username: "nacos"
password: "xxxxxxxx"
registry:
type: nacos
nacos:
application: seata-server
server-addr: xxxxxx:8848
group : "SEATA_GROUP"
namespace: "dev"
username: "nacos"
password: "xxx"
from incubator-seata.
已经解决了,刚才仔细看了下官网版本对照信息:地址,发现是我seata依赖的版本不对。
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<!-- <version>2.0.0</version>-->
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<version>2.2.6.RELEASE</version>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
from incubator-seata.
springboot version: 2.3.12.RELEASE --> 2.3.2.RELEASE
seata version: 2.00 ---> 1.3.0
from incubator-seata.
Related Issues (20)
- PropertyClass for prefix: [seata.tcc] should not be null
- 大佬,求一个 spring项目(非springboot)+ grpc 接入seata的文档 HOT 1
- seata server优雅下线方案实现 HOT 5
- seata 1.3版本 全局事务回滚报错提示数组下标越界,有哪位大佬知道这个问题是什么原因导致的吗? HOT 1
- task: Improve the test case coverage of [core] module to 70% HOT 1
- task: Improve the test case coverage of [discovery] module to 70%
- task: Improve the test case coverage of [spring] module to 70%
- task: Improve the test case coverage of [seata-spring-boot-starter] module to 70%
- task: Improve the test case coverage of [rocketmq] module to 70%
- task: Improve the test case coverage of [integration-tx-api] module to 70%
- task: Improve the test case coverage of [sqlparser] module to 70%
- task: Improve the test case coverage of [saga] module to 70% HOT 1
- XA事务模式下写入的查询不到数据 HOT 4
- XA事务模式下写入的查询不到问题探讨 HOT 9
- seata1.5.2 配置mysql集群连接方式的时候 使用错误 HOT 3
- AT模式支持TDSQL FOR PG吗 HOT 1
- [pc.netty.AbstractNettyRemoting]: 0104 ==> java.lang.RuntimeException: channel is error. HOT 3
- 针对于达梦的批量插入,目前分布式AT模式不支持分布式事务 HOT 2
- kotlin-maven-plugin compilate failure in Java 17
- [druid 版本升级]请问下个版本大概多久发布,依赖的druid会升级到最新版本嘛? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-seata.