0

我无法将属性添加到约束,也无法映射到已扩展我新创建的域的域。

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”:无效标识符

4

1 回答 1

0

改用 Groovy Traits:

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' 
    }
}
于 2019-01-24T03:19:18.467 回答