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 に答える