同一实体上的多对多关系,无需额外的连接表列

发布于 2024-09-12 03:05:28 字数 224 浏览 1 评论 0原文

我有一个与其自身具有多对多关联的实体。

如果我需要一些额外的属性(例如这里询问) 答案是使用一个新的中间实体。但是如果没有它们,使用与实体本身的直接多对多关联是不好的做法吗?

I have an entity that has many-to-many association to itself.

If I needed some additional properties (like asked here) the answer would be to use a new intermediate entity. But without them is it bad practice to use direct many-to-many association to the entity itself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

前事休说 2024-09-19 03:05:28

Aleksey,

如果您有其他列,您需要一个新的中间实体

但是如果没有它们,使用与实体本身的直接多对多关联是不好的做法吗?

不,如果您愿意,您可以因为您在连接的表上没有其他列

Aleksey,

If you have additional columns, you need a new intermediate Entity.

But without them is it bad practice to use direct many-to-many association to the entity itself ?

No, you can if you want since you do not have additional columns on The joined Table

半世蒼涼 2024-09-19 03:05:28

使用映射表是 N 到 N 关系的最佳方式,而无需在映射表本身中创建新列。

Using a mapping table is the optimal way for N to N relations without creating new columns in the mapped tables themselve.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文