grails belongsTo使用
4414 ワード
詳細
grails 3 belongsTo,多対一関係
参照先:http://docs.grails.org/latest/ref/Domain%20Classes/belongsTo.html
オブジェクトの説明:
作者:Author
ブック
BookはAuthorに属しています
grails 3 belongsTo,多対一関係
参照先:http://docs.grails.org/latest/ref/Domain%20Classes/belongsTo.html
オブジェクトの説明:
作者:Author
ブック
BookはAuthorに属しています
static belongsTo
:
:
static belongsTo = Author //[Domain1,Domain2]
, 。
, , 。
domain:
class Author {
String name
static constraints = {
}
}
class Book { static belongsTo = Author String title static constraints = { } }
: : ========================================================================================
: static belongsTo = [author:Author]//[doamin:Domain1,domain2:Domain2] : Author author static belongsTo = Author Book Author (author_id)
doamin:
class Author { String name static constraints = { } }
class Book { static belongsTo = [author: Author] String title static constraints = { } }
:
:
author , book author 。