2012-01-17 11 views
0

У меня Alert есть много объектов Location, и у меня есть таблица соединений alert_locations.Grails Join Table column name

Генерируемые столбцы:

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) 
    } 
} 
+0

возможно дубликат [Grails таблица контроля соединения] (http://stackoverflow.com/question s/8897524/Grails-контроль, нарисуйте таблицу) –

ответ

3
static mapping = { 
    locations joinTable:[column:"location_id", key:"alert_id"]