In Grails 1.3.7 I've spent quite some time to convert my domain class relations according to Burt's suggestions in http://www.infoq.com/presentations/GORM-Performance
Now, Grails 2 supports Hibernate's Bags and I am considering to revert my changes back to hasMany
/belongsTo
.
- With which option will I be more future-proof?
- Which problems might arise if I stick to the manual/explicit implementation?
- Which problems might arise if I switch to Bags?
- Is there any advantage in either variant compared to the other?
Note that the application will see long-term improvements over many years (so no 'deploy-and-forget' :).
UPDATE: One main concern is how much hassle it would incur in regards to manual changes in the database if I did the change after the app goes live. Currently it is unreleased, so it poses to be reasonable before Go-Live.
UPDATE: THE ANSWER
In the blogpost 'Hibernate Bags in Grails 2.0' dated November 2011, Burt Beckwith describes issues with Bags in Grails 2 and concludes:
So I guess I’m back to advocating the approach from my earlier talks; don’t map a collection of Books in the Author class, but add an Author field to the Book class instead
So the answer is to stick with the converted (i.e. non-set/-list/-bag) variant.
Please vote for re-opening this thread so it may be answered & accepted in correct fashion.