在mysql表中,我无法改变鉴别器值

时间:2012-09-07 11:45:35

标签: grails inheritance mapping discriminator

在grails中,我有三个类,如:

1

package com.p1
class Node {
    static constraints = {
        name(blank:false,nullable:true)
    }
    String name
    static mapping = {
        discriminator column:"Node_Type"
    }
    String toString() {
        "$name"
    }
}

2

package com.p1
class Task extends Node {
    static constraints = {
    }   
    static mapping =  {
        discriminator value:"TASK_NODE"
   }
}

3

package com.p1
class Decision extends Node{
    static constraints = {
        assignee(nullable:true)
    }
    String assignee
     static mapping =  {
         discriminator value:"DECISION_NODE"
    }

}

在MySQL表中,我可以将鉴别器列名称设为Node_Type但我无法获得列值,如TASK_NODEDECISION_NODE

相反,我会这样[com.p1.Taskcom.p1.Decision]

0 个答案:

没有答案