I've got a legacy object structure like this:
Code:
public class FirstClass {
Set<Child> children;
}
public class SecondClass {
Set<Child> children;
}
public class Child {
Set<GrandChildren> children;
}
FisrtTable:
primary key (id);
FirstTableChild
primary key(ch_id)
foreign key fk_id
FirstGrandChildren
primary key(gr_ch_id)
foreign key fk_ch_id
SecondTable:
primary key (id)
SecondTableChild
primary key(ch_id)
foreign key fk_id
SecondGrandChildren
primary key(gr_ch_id)
foreign key fk_ch_id
We are considering using Hibernate as new persistent layer, but don't know how to map above mentioned structure.
I cannot use <composite-element /> because it does not support set as property.
I cannot use <set /> without composite, because GrandChildren is stored in two tables... and Hibernate cannot map one classes in more contexts into another tables.
Can anybody help me, please?