lanxw opened a new issue, #23047:
URL: https://github.com/apache/shardingsphere/issues/23047
When shardingProxy5.2.1 integrates mybatis-plus v3.5.2, calling the insert
method successfully, but cannot return the PK primary key value when entity
have associated(Use Single Insert is OK),I using the default snowflake
algorithm and build in spring boot v2.7.6 and mysql 8
Test Case in shardingJDBC5.2.1 is OKļ¼can return the PK primary
Help, Thanks!
```java
@TableName("bus_statement")
@Data
public class Statement {
@TableId(type = IdType.ASSIGN_ID)
private Long statementNo;
......
}
---------------------------------------------------
@Test
public void testInsertAssociatedData(){
Statement statement = new Statement();
......
statementMapper.insert(statement);
for (int j = 0; j <3 ; j++) {
StatementItem item = new StatementItem();
//statement.getStatementNo() is NULL
item.setStatementNo(statement.getStatementNo());
......
statementItemMapper.insert(item);
}
}
---------------------------------------------------
rules:
- !SHARDING
tables:
bus_statement:
actualDataNodes: customer_data$->{0..1}.bus_statement$->{0..1}
databaseStrategy:
standard:
shardingColumn: customer_phone
shardingAlgorithmName: alg_inline
tableStrategy:
standard:
shardingColumn: statement_no
shardingAlgorithmName: alg_mod
keyGenerateStrategy:
column: statement_no
keyGeneratorName: alg_snowflake
keyGenerators:
alg_snowflake:
type: SNOWFLAKE
shardingAlgorithms:
alg_mod:
type: MOD
props:
sharding-count: 2
alg_inline:
type: INLINE
props:
algorithm-expression: customer_data$->{customer_phone % 2}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]