【发布时间】:2014-01-03 09:35:48
【问题描述】:
嗨,假设我有一个域类
class Book{
static hasOne=[author:Author]
long id
String name
}
class Author {
static hasMany=[books:Book]
long id
String name
}
我有一个 json 对象发送进来。我可以只做一个new Book(Json) 而不手动设置属性吗?
【问题讨论】:
-
这样做会发生什么?
-
你可能需要使用 new Book(JSON.parse(params)) 来为 GORM 获取正确的格式
标签: json grails grails-domain-class