reference vs. id

  • In modern JVMs, references are implemented as an address.
  • use id or reference?
    • use id
      • lost the advantage from hibernate/gorm,
      • will lazy loading works?
      • can we get id without lazy loading?
      • the purpose is not to load too many data
      • You are basically ignoring the power the ORM can give you.Remember that a.getB().getId() will not initialize the B instance! It’s only when you actually access additional methods and properties of B (or you explicitly queried for it) that a (good) ORM like Hibernate will actually bother fetching B
    • when grails will load the child instance?
    • lazy loading
      • static mapping = { childs lazy: true }
    • although child is loaded in grails, but it still not rendered
    • how to load some child object but not all?
This entry was posted in Design, Knowledge. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s