A question about how to persist aggregate objects...
Take the situation below...
Code:
public class Sub1 {
private long Value1
private long Value2
}
public class Sub2 extends Sub1 {
private String Value3
}
public class Sub3 extends Sub1 {
private double Value4
}
pubic class Main1 {
private Sub1 Sub
}
The 'Main1' class can have a value set into the 'Sub' field that is an instance of either 'Sub1', 'Sub2' or 'Sub3'. The only way I can see of persisting this is to have a separate table called 'sub' for the 'Sub1'/'Sub2'/'Sub3' instances and a one-to-one join from Main1 to sub.
Are there any other approaches?