Greetings.
I am working on creating a tree structure to hold my domain objects.
The tree should hold an infinite level and amount of nodes, and each node hold one object (but the same object can be held by multiple nodes). These objects are typically Users, user groups, articles, folders, comments et.c.
To illustrate:
Code:
|-Object A
|
|-Object B
| |
| - Object A
| |
| - Object D
| |
| - Object C
|-Object C
I have followed a tutorial I found at
http://www.thogau.net/tutorials/tree/, and so far so good. In this example each node merely contains a string, and I want to hold an object. So i believe I have to go with one of the three approaches to inheritance mentioned in chapter 3.6 in "Hibernate In Action": Table per concrete class, table per class hierarchy or table per subclass. Of wich the "Table per class hierarchy" seems most appealing to me at first sight.
Am I correct in my reasoning for the use of inheritance and is the "Table per class hierarchy" a suitable method in this scenario? Also, is the approach to a tree structure outlined in the tutorial a sensible way?
Regards,
daijavad