I have roughly the following in my grails 1.1 app
class AppCategory {
static belongsTo = App
static hasMany = [ apps: App ]
String name
}
class App {
static hasMany = [ categories: AppCategory]
String name
}
App app = new App()
AppCategory appCat = AppCategory.findByName('blah')
app.addToCategories(appCat)
app.save()
The correct tables (app, app_category and app_categories) are created and the columns all seem fine, but I don't end up with any records in the association table and no errors. The app_category table and app table are correctly populated.
Do I need to manually manage a domain object for the association table? Or better yet, am I just missing something totally obvious?