我的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)
}
}
最佳答案
static mapping = {
locations joinTable:[column:"location_id", key:"alert_id"]
关于grails - Grails联接表列名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8898427/