[英]domain design in grails for related things
using Grails 1.1.1 使用Grails 1.1.1
I have domain in Grails Person. 我在Grails Person中拥有域。 Person can be related to another Person buut they can be stand alone. 一个人可以与另一个人建立联系,他们可以独立存在。 this is like: 就像:
I have A as my friend and A have me as his friend 我有一个A作为我的朋友,一个A有我作为他的朋友
B can be stand alone (not having friend) B可以一个人呆着(没有朋友)
should I type 我应该输入
Person {
belongsTo = [friend:Person]
hasMany = [persons:Person]
constraints {
friend(nullable:true)
}
}
and how to delete A ? 以及如何删除A?
Why do you need the friend property? 为什么需要朋友财产? Don't you just want a person to have zero to many friends? 您不只是希望一个人的朋友数为零吗?
Person {
hasMany = [friends:Person]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.