Grails加入表列名称

时间:2012-01-17 16:47:05

标签: grails groovy gorm jointable

我的Alert有很多Location个对象,我有联接表alert_locations

生成的列为:

alerts_locations_id(我希望这是alert_id

location_id

这是我的域名对象:

class Alerts { 

    static hasMany = [locations:Locations,notifications:Notifications]

    Date alertDateTime
    String pest
    String crop

    static constraints = {
        alertDateTime (blank:false)

        pest (blank:false)
        crop (blank:false)
    }
}

1 个答案:

答案 0 :(得分:3)

static mapping = {
    locations joinTable:[column:"location_id", key:"alert_id"]