i have four class:Zone,Station,Mhouse,ConnectMap, they composed a tree structure.
Code:
Zone-|-Station----------|-Mhouse------------ConnectMap
|-ConnectMap |-ConnectMap
Zone's children node is Station and ConnectMap
Station's children node is Mhouse and ConnectMap
Mhouse's children node is ConnectMap
now ,the problem is :how to design ConnectMap?because it can act as Zone,Station,Mhouse's children node.
if like
Code:
public class ConnectMap (){
private Long id;
private String name;
private Zone zone;
private Station station ;
private Mhouse mhouse;
..............................
}
but how to design table,Zone,Station,Mhouse store in diffirent table,
if ConnectMap 's table is :
Code:
number id;
varchar2 name;
number parentid;
hbm like: