You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/12/13 03:50:51 UTC

[GitHub] [incubator-shardingsphere] peiyou commented on issue #3713: How do you return the auto-generated id after inserting data?

peiyou commented on issue #3713: How do you return the auto-generated id after inserting data?
URL: https://github.com/apache/incubator-shardingsphere/issues/3713#issuecomment-565289493
 
 
   > Can you try to example first?
   There are table1 and table2, the table1_id of table2 is the ID of table1, and the table1 ID is generated automatically by the snowflake algorithm built in sharding-jdbc.
   Now, I'm in the same transaction, I'm adding a piece of table1 data (the transaction didn't commit), and then I need to add table2 data, but I need the ID value of table1, the ID value of this table1, and I can't get that ID at this point.
   In mybatis, if table1's ID is automatically generated, the generated ID is automatically injected into the inserted entity class. So I can get the generated ID value from the ID field in the entity class.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services