ywang1000 wrote:
I have a pretty lazy requiremet from the users to save/get/delete the parent object, but it also requires to save/get/delete all of the objects inside the parent object.
Is this something the users actually demanded, or something the analysts thought up? :) Before you go any further, you should clarify this requirement a bit, i.e. when you load the parent, do you also need to load all children and grandchildren? This can have an impact later on when more and more children/grandchildren are added to your tree(s).
Now, assuming everything you've posted is *the* requirement, you just need some one-to-many mappings. For example:
Code:
<set name="children">
<key column="PARENT_ID"/>
<one-to-many column="CHILD_ID" class="Child"/>
</set>
Of course, you can also specify lazy="true" to lazy load children/grandchildren as needed, but that really depends on your requirement...
jd
____________________
Don't forget to rate!