There are times when I want to define relationships as lazily loaded, since 90% of the time when I do not want child entities, but they also have the ability to immediately get the entire hierarchy under certain circumstances. I do not want to achieve this using a named query, as the parent-child hierarchy is useful when I convert, for example. JSON Right now my dirty hack is to call .getChildEntities (). Size () to force lazy loading in a single transaction.
Is there a better way?
source share