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