I've got a class called "Area". Each Area can have multiple sub-areas (of the same type).
I need to be able to determine sub-areas and root-areas. Sub-areas can have sub-areas themself.
This can be quite a few levels deep.
Example:
Code:
Rootarea
|- Subarea 1
| |- Subarea 2
| |
| |- Subarea 3
|
|- Subarea 4
| |- Subarea 5
Code:
public class Area {
private Area parent;
private List<Area> children;
private String name;
//getters and setters here ommitted
}
How do I model such a Java-class with Hibernate xml config files?
..and
How do I load to memory the areas tree?
thanks