I have a one-to-many relationship between class Parent and class Child. Child instances can be persisted without a parent (they can be orphaned). I have the following tables (simplified):
table 'parent': integer id table 'parent_children': integer parent_id, integer child_id table 'children': integer id
However, I have a complex 'child' class and saving/loading involves spanning multiple data sources. As such, I would like to have hibernate manage 'parent' and the relationships between the parent and its children, but I don't actually want to enable transitive persistence for the Child instances themselves; only the relationship between the two. However, I would still like to be able to load the full graph when loading a 'parent' object.
Is this possible via hibernate? Is there any way to manage associations without cascading all the way down to the child entities? I would welcome any workarounds as well. I'm using external hibernate mapping files (.hbm.xml) rather than annotations.
|