如何解决实体Grails映射中的重复列?
我有这门课:如何解决实体Grails映射中的重复列?,grails,mapping,gorm,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 {
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对象。而且密钥始终是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
为什么要将propertyMake和propertySize映射到同一列中?数据库已经像这样映射了。。。我们只是在维护这个系统。TFTire列有三个不同的列,如IFPropertyMake IFPropertySize和IFPropertyType。。。它们是TFTireProperty的密钥,它的主键是我需要加入TFTire的siteID和IDRec。。。