Greach 2017 - hasMany Considered Harmful - Burt Beckwith
Why Stack Overflow recommends it
Stack Overflow users link it when answering Grails and GORM questions about many-to-many mapping problems, to back the advice to avoid mapped collections and model relationships with separate domain classes or queries.
Recommended by 0 people across 0 different months, 2017 to 2018.
What it is
A Greach 2017 conference talk by Burt Beckwith arguing that Grails developers should stop using hasMany and mapped collections in GORM because of hidden performance costs. It revisits his 2010 SpringOne/2GX talk with updated code and shows simpler alternatives for one-to-many and many-to-many relationships.
What people said
Cites V H · 2017-04 · Stack Overflow · on “Grails - Multiple Many-to-Many via Custom Join Tables w/ Cascade Delete & Same Class w/o belongsTo”
I have removed my answer since you are suggesting you are going to downvote it. Even though it was intended to make you try and see differently to how you have received requirements and appear to demand that this must be the way it should work. As i suggested and still stick with what i said, personally see no benefit of employee having many emails and then emails having many employees. You can do a query from employee to work this out if required. [this video] this may be of help to you.
Cites Jabrwoky · 2018-04 · Stack Overflow · on “Grails StaleObjectStateException in lock() method”
We fixed 100% of our StaleStateException/OptimisticLocking issues by: We don't explicitly lock anything. We adjusted the code flow and objects to minimize the chance of lock contention using the following Removing all @Transactional annotations from all controllers. Move code that modifies domain objects from controllers into services. Never modify a domain object in a controller, ever. Only delegate to services (which are transactional by default) to modify domain objects. Perhaps you did this in this case, but make sure you do it 100% of the time. Don't disable optimistic locking, it's there for a reason. Without it, you run the risk of overwriting an update from a different transaction. I
Cites Juan Reséndiz · 2018-08 · Stack Overflow · on “Many-To-Many relationship not persisted using GORM and Grails”
Seems to be an issue in how the GORM works, check the next link [LINK] package mx.jresendiz27.gorm.test class BootStrap { def init = { servletContext -> // [LINK] // works new Author(name:"Stephen King") .addToBooks(new Book(title:"The Stand")) .addToBooks(new Book(title:"The Shining")) .save() // does not work, should use save in each author new Book(title:"Groovy in Action") .addToAuthors(new Author(name:"Dierk Koenig").save()) .addToAuthors(new Author(name:"Guillaume Laforge").save()) .save(flush:true, failOnError: true) } def destroy = { } } Also I recommend you using different domains for handling the many-to-many relationships, because it's harmful [this video] to use the relationships in t