spring - joining two tables with non-Primary key attributes using hibernate annotations -
i have table attributes a1(pk), a2, a3
i have table b attributes b1(pk), b2 , b3
now, need join table , b on basis of a3 = b3.
can tell me how in hibernate annotations using join. problem how specify column of table mapped on column of table b in mapping file both column not primary keys.
like this:
b { @manytoone @joincolumn(name = "b3", referencedcolumnname = "a3") privte a; }
you have specify in relationship columns joined.
for vise versa:
a { @onetomany @joincolumn(name = "a3", referencedcolumnname = "b3") privte list<b> blist; }
Comments
Post a Comment