apache / apache/incubator-seata

seata + mybatisplus + postgres, insert record id becomes null

Open
#6,054 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
用mapper插入新的用户信息的时候id 是null ,数据库是postgres, 我加了seata的@globaTransactional 之后就变成null 了, 没加这个注解是可以正常插入的。如果换成mysql 也能正常插入。 试过把posgres 的id 换成int 和bigint 都不行
![WechatIMG32080](https://github.com/seata/seata/assets/48542562/5df59eec-e7dc-4b94-bab3-7f102536ad8a)

### Ⅵ. Environment:

- JDK version(e.g. `java -version`): Java 11
- Seata client/server version: 1.7.0
- Database version: postgres 16
- OS(e.g. `uname -a`): Mac
- mybatis plus:3.4.0
- Others:

Contributor guide

Open the contributing guide

Research direction

Start with the MyBatis-Plus mapper insert executed under Seata's @GlobalTransactional and compare it with the same insert without the annotation and against MySQL. Review the PostgreSQL 16 setup and the Java 11, Seata 1.7.0, and MyBatis-Plus 3.4.0 versions. Done means the inserted PostgreSQL record receives its generated ID while the global transaction is active.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, postgresql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.