如何解决实体的Grails映射中的重复列?

时间:2015-05-12 23:51:57

标签: grails mapping gorm

我有这堂课:

class TFTire implements Serializable {
    TFTireProperty propertyMake
    TFTireProperty propertySize

这个映射:

static mapping = {
    version false
    table 'TF_TIRE'
    id composite:['siteID','idRec'], generator: "assigned"
    columns {
        idRec column: 'IDRec'
        siteID column: 'SiteID'
        propertyMake {
            column name: "siteID", joinTable: true
            column name: "IFPropertyMake"
        }
        propertySize {
            column name: "SiteID", joinTable: true
            column name: "IFPropertySize"
        }

如果我只保留一个TFTireProperty,它可以正常工作。但我需要参考更多两个TFTireProperty对象。关键是siteID和IFPropertySomething。

我有两个错误:

Caused by MappingException: Repeated column in mapping for entity: com.mdw360.TFTire column: SiteID (should be mapped with insert="false" update="false")
->>  262 | run       in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run       in java.lang.Thread

0 个答案:

没有答案