好吧,我有一个客户档案,上面有联系电话。说,用户A有2部手机。如果我在Java端设置connection.setAutoCommit(false);
,则将有2个存储过程来运行此事务:(1)添加配置文件& (2)循环添加手机。如何在设置提交之前获取CustomerId?当中间会有新的CustomerId提交时,这是数据一致性的潜在问题吗?
tbl_customer
CustomerId (PK, NOT NULL, UNIQUE, AUTO_INCREMENT)
CustomerName
Address
(etc)
tbl_contact
ContactId (PK, NOT NULL, UNIQUE, AUTO_INCREMENT)
CustomerId (FK REFERENCES tbl_customer(CustomerId), CONSTRAINT)
ContactType
ContactNumber