Reputation: 1562
My Alert
has many Location
objects, and I have the join table alert_locations
.
The generated columns are:
alerts_locations_id
(I want this to be alert_id
)
location_id
Here's my domain object:
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)
}
}
Upvotes: 0
Views: 3677
Reputation: 19702
static mapping = {
locations joinTable:[column:"location_id", key:"alert_id"]
Upvotes: 3