开发者

Should I convert my Grails domain relations to use Hibernate Bags? [closed]

开发者 https://www.devze.com 2023-04-07 00:30 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.inf开发者_开发百科oq.com/presentations/GORM-Performance

Now, Grails 2 supports Hibernate's Bags and I am considering to revert my changes back to hasMany/belongsTo.

  1. With which option will I be more future-proof?
  2. Which problems might arise if I stick to the manual/explicit implementation?
  3. Which problems might arise if I switch to Bags?
  4. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号