vincent lt
vincent lt

Reputation: 1

grails : Same physical table name references several logical table names

I have a problem with GORM mappings. I get this error

"Same physical table name [immunohistological_analysis] references several logical table > names: [STImmunoAnalysis], [GTImmunoAnalysis]"

I get the error because I map the same table's name from two pojos coming from two datasources as follow :

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'
    }

}

Thanks for your help.

Upvotes: 0

Views: 768

Answers (1)

MKB
MKB

Reputation: 7619

This is because both the domains referring to the same table:

class GTImmunoAnalysis {    
    ...
    static mapping = {
        ...
        table "immunohistological_analysis"
        ...
    }
}

class STImmunoAnalysis {
    ...
    static mapping = { 
        ...
        table "immunohistological_analysis"
        ...
    }
}

Try changing name of the tables:

class GTImmunoAnalysis {    
    ...
    static mapping = {
        ...
        table "gt_immunohistological_analysis"
        ...
    }
}

class STImmunoAnalysis {
    ...
    static mapping = { 
        ...
        table "st_immunohistological_analysis"
        ...
    }
}

Upvotes: 1

Related Questions