I'm a new hibernate user so first, hello everybody!
I was reading about parent-child relationships and it looks like the reference to the parent is set using:
child.setParent(parent);
OK, nothing unusual sa far. But this implies that the parent entity must be loaded when the child is saved. We have two approaches:
1. Cache the parent.
2. Load the parent based on the ID.
Is there a third approach where we can set the parent only by using the ID (no caching, no additional load)?
This paradigm appears quite frequently in web applications, for instance when you create an ORDER_ITEM entity that references a PRODUCT entity for which only the ID is available(in the HTTP request).
Thank you,
Bogdan Calmac
knoa software.
|