[問題] Grails GORM請教
目前有點混淆了
我大致能理解 one to one、one to many、many to many 的意義
但以下有幾個關係想請教一下有甚麼不同
首先是興趣Favorite類
class Favorite{
String name
String type
}
以下有兩個關於Person類的疑問
1.
class Person{
static hasmany = [favorites:Favorite]
}
2.
class Person{
Favorite favorites
static hasmany = [favorites:Favorite]
}
3.
class Person{
Collection favorites
static hasmany = [favorites:Favorite]
}
1~3我有在mysql上實做 3種實做都會通過
但請問第1~3種Person之間有意義的不同嗎?
在與Favorite之間的關聯在DB上會長的一樣嗎?
第四種
class Person{
Favorite favorites
}
請問第四種 以P的角度來說 跟F是甚麼關係
one to one? one to many? many to one?
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.133.221
※ 編輯: Deltaguita 來自: 118.169.133.221 (01/26 02:26)
※ 編輯: Deltaguita 來自: 118.169.133.221 (01/26 02:26)
推
01/26 09:47, , 1F
01/26 09:47, 1F
※ Deltaguita:轉錄至看板 Database 01/26 15:40