how to map one to many relation for a single table in hibe# Java - 爪哇娇娃
b*e
1 楼
table 2 is denormalized.
Table 1 (A) A is primary key
Table 2 (A, B, C, V), A, B, C is primary key. A is foreign key to Table
1(A), Table 1 to Table 2 is one to many relation
The classes are like below.
Class 1
{
A;
Set
}
Class2
{
Class1 c1;
B;
Set sets;
}
Class3
{
Class2 c2;
C;
V;
}
How can I config the mapping for class1 and class2 and class3 and make
hibernate not to do a separate insert/update for class2 when persistence
class 1 but to insert/update class 2 and class3 together in one sql?
Table 1 (A) A is primary key
Table 2 (A, B, C, V), A, B, C is primary key. A is foreign key to Table
1(A), Table 1 to Table 2 is one to many relation
The classes are like below.
Class 1
{
A;
Set
}
Class2
{
Class1 c1;
B;
Set
}
Class3
{
Class2 c2;
C;
V;
}
How can I config the mapping for class1 and class2 and class3 and make
hibernate not to do a separate insert/update for class2 when persistence
class 1 but to insert/update class 2 and class3 together in one sql?