2017-02-20 62 views
0

在我的Grails 3.2.6应用程序我有2类:抽象域类和tablePerHierarchy

abstract class Base { 
    static mapping = { 
    tablePerHierarchy false 
    }  
} 

class Child extends Base { 
    static mapping = { 
    collection 'child' 
    } 
} 

在保存儿童的情况下,倾入“基地”集合(与_class = Child字段)而不是“孩子”。

如何使它正常工作?

UPDATE

我定义了Basetraitsrc/main/groovy

trait Base { } 

class Child implements Base { } 

则一切正常。

回答

0

在孩子类映射方法,添加此

table "child" 
+0

是由GORM蒙戈忽略,以及收集这种情况下, – injecteer