GORM映射存在问题。我收到此错误
"相同的物理表名称[immunohistological_analysis]引用了几个逻辑表>名称:[STImmunoAnalysis],[GTImmunoAnalysis]"
我收到错误是因为我从两个来自两个数据源的pojos中映射了同一个表的名称,如下所示:
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'
}
}
感谢您的帮助。
答案 0 :(得分:1)
这是因为两个域都引用了同一个表:
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"
...
}
}