我无法将属性添加到约束中,也无法映射到已扩展为我新创建的域的域。
class Person1 {
String name
static constraints = { name nullable : true }
static mapping = {
table 'PERSON'
name column : 'PERSON_NAME'
}
}
class Person2 extends Person1 {
String address
static constraints = { address nullable : true }
static mapping = {
address column : 'PERSON_ADD'
}
}
关于如何正确执行此操作的任何想法?
我遇到错误
消息:ORA-00904:“ THIS _”。“ CLASS”:无效的标识符
答案 0 :(得分:0)
改为使用Groovy特性:
http://docs.groovy-lang.org/next/html/documentation/core-traits.html
trait Person1 {
String name
static constraints = { name nullable : true }
static mapping = {
table 'PERSON'
name column : 'PERSON_NAME'
}
}
class Person2 implements Person1 {
String address
static constraints = { address nullable : true }
static mapping = {
name address : 'PERSON_ADD'
}
}