0

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)
    }
}
4

1 回答 1

3
static mapping = {
    locations joinTable:[column:"location_id", key:"alert_id"]
于 2012-01-17T17:02:13.403 回答