JDBI 如何从一个@SqlUpdate 中的两个表中删除数据
JDBI how can I delete data from two tables in one @SqlUpdate
我有两个 table:
entities:
- id
- someValues
和其他 table,在 id 字段上有外键
connectedEntities:
- entityId (foregin)
- otherObjectId (foregin)
我需要通过 id 删除实体,但是当我尝试仅从 entities
table 中删除时,存在 FK 违规。
此外,我想使用 @SqlUpdate 或 JDBI 框架中的其他注释。
有人知道如何做这样的事情吗?
感谢@G_H,我找到了我要找的东西。
我只需要将 ON DELETE CASCADE
添加到我的外键定义中,一切正常。
我有两个 table:
entities:
- id
- someValues
和其他 table,在 id 字段上有外键
connectedEntities:
- entityId (foregin)
- otherObjectId (foregin)
我需要通过 id 删除实体,但是当我尝试仅从 entities
table 中删除时,存在 FK 违规。
此外,我想使用 @SqlUpdate 或 JDBI 框架中的其他注释。
有人知道如何做这样的事情吗?
感谢@G_H,我找到了我要找的东西。
我只需要将 ON DELETE CASCADE
添加到我的外键定义中,一切正常。