The problem is to select several parent entities and link them with corresponding children. For such task parents should not be loaded at all (e.g. only collection of ids) or loaded with lazy fields.
- Is there API (workarounds) to link 2 entities by their ids? E.g. without loading parent and call
setChild
. - Is there a way to load parent with all lazy fields even if some of them defined as eager? As I have searched that hibernate supports overriding for loading types. E.g. it is possible write
Criteria
which loaded only selected fields. But this is not comfortable way, because new entity classes can be added with eager type. - Can I load a projection with same child, set children to it and then persist it like entity class?