Is there a belongsTo mixed syntax for GORM many-to-many and back-reference
I've come across a peculiarity in GORM mapping. What I expect table-wise is models designs (model_id -> models.id) categories categories_design (category_id, design_id) To get a model_id in designs, I would use map syntax static belongsTo = [model:Model] So now, I also have a hasMany relationship between Design and Category and the owning side is Design. The GORM manual says to denote an owning side using non-map syntax static belongsTo = Category BUT, I also need the back reference from Design to Model that uses map notation. My question is how do you mix the 2 cases? I have tried, in Design: static belongsTo = [model:Model, category:Category] This gets a runtime error - No owner defined between domain classes Category and Design in many-to-many relationship. static belongsTo = [model:Model, Category] This gives a compile error. static belongsTo = [Model, Category] The expected model_id is not created in Design, instead a whole new table for models_designs is created which is not right. But everything compiles and runs.
If you have a hasMany relation between Design and Category and Design is the owning side, should you not have a static hasMany = [category: Category] in Design class and static belongsTo = Design in Category class. In this way, you can still keep static belongsTo = [model:Model] in the Design class.
Adding condition to findAll and findAllBy methods
Neo4j and Mongodb as datasource in Grails
GORM (varchar .save(), non DATE): ORA-01861: literal does not match format string
GORM addTo methods not found in Spock test
spring-boot property exception while externalizing datasource properties and using actuator
Mapping hasMany relation and saving the related data
Method on class  was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails Correctly
What happens when two app servers in cluster start LiquiBase update (via Grails)?
use of mappedBy in Many to Many relationship in Grails
Domain class auto validation in grails
Grails Detached Criteria Query and “group by” and “having” clause
Script for saving large no of entries in mongodb
Does the multiple datasource feature of Grails 2.0 support relations?
How to avoid ImprovedNamingStrategy in joinTable in Grails
Grails 2 Show transient property that is an alias for id column
How to save GORM class with composite id made from its own field?