我对GORM映射有疑问。我得到这个错误
"Same physical table name [immunohistological_analysis] references several logical table > names: [STImmunoAnalysis], [GTImmunoAnalysis]"
我收到错误是因为我从来自两个数据源的两个pojo中映射了同一个表的名称,如下所示:
class GTImmunoAnalysis {
...
static mapping = {
datasource 'generictracker'
table "immunohistological_analysis"
id generator: 'assigned', name: 'acc', column: 'acc'
slideAcc column: "slide_acc"
receptor column: "receptor"
tumorReceptor column: "tumor_receptor"
percent column: "percent"
score column: "score"
amplified column: "amplified"
version false
cache 'read-only'
}
}
class STImmunoAnalysis {
...
static mapping = {
datasource 'sampletracker'
table "immunohistological_analysis"
id generator: 'assigned', name: 'acc', column: 'acc'
slideAcc column: "slide_acc"
receptor column: "receptor"
tumorReceptor column: "tumor_receptor"
percent column: "percent"
score column: "score"
amplified column: "amplified"
version false
cache 'read-only'
}
}
谢谢你的帮助。
最佳答案
这是因为两个域都引用同一个表:
class GTImmunoAnalysis {
...
static mapping = {
...
table "immunohistological_analysis"
...
}
}
class STImmunoAnalysis {
...
static mapping = {
...
table "immunohistological_analysis"
...
}
}
尝试更改表名称:
class GTImmunoAnalysis {
...
static mapping = {
...
table "gt_immunohistological_analysis"
...
}
}
class STImmunoAnalysis {
...
static mapping = {
...
table "st_immunohistological_analysis"
...
}
}
关于grails - grails:相同的物理表名称引用了多个逻辑表名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27899457/