Joined: Sat Oct 25, 2008 1:05 am Posts: 9
|
My requirement is generate tree menu.
I have a table with parent -child reference of same table
my mapping file :-
<class name="sample.TreeMenu" table="TISSTREEMENU" lazy="true">
<id name="menuId" type="int">
<column name="MENU_ID" />
<generator class="assigned">
</generator>
</id>
<property name="menuName" type="string">
<column name="MENU_NAME" length="10" not-null="true" />
</property>
<property name="parentMenuId" type="int">
<column name="PARENT_MENU_ID" />
</property>
<many-to-one name="parent" class="sample.TreeMenu" fetch="join" update="false" insert="false" >
<column name="PARENT_MENU_ID" />
</many-to-one>
<set name="children" inverse="true" outer-join="true">
<key>
<column name="PARENT_MENU_ID" />
</key>
<one-to-many class="sample.TreeMenu" />
</set>
</class
Could anyone suggest ,how to load whole tree menu with single SQL?
|
|