Grails - 多个对象数据库关系
我有一个非 Grails 特定的问题,但我打算用它来实现它。 反正。我希望有一个一对多的域类关系,但我希望“多”部分有几种不同的类型。
例如: 一个域 Class Man
将有多个 Friends
(这是我们的一对多关系),但 Friends 位可能是另一个具有其特定属性的 Man
方法和属性集,或狗
,或怪物
等。
我浏览过网页,但不知道如何正确命名我正在搜索的内容。 非常感谢任何帮助
I have a non-Grails specific question, but I intend to implement it with it.
Anyway. I would like to have a One-to-Many domain class relationship, but I would like the Many part to be of several different types.
For instance:
A domain Class Man
would have several Friends
(this is our 1 to Many relationship), but the Friends bit could be another Man
with its particular sets of methods and attribute, or a Dog
, or a Monster
, etc.
I have browsed the web but do not know how to name properly what i am searching for.
Any help greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能试试这个吗?我不确定%100,但你应该这样做。您需要一个用于继承的接口。
Can you try this? I am not sure %100 but you should do something like this. You need an interface for inheritance.