I have 2 tables viz. TABLE1 and TABLE2:
TABLE1 has it's PK as {ID}
TABLE2 has composite-id as {A,B,C}... TABLE2 also has a column {D}
TABLE1 and TABLE2 are associated with one-to-one mapping TABLE1.ID=TABLE2.A
Cascade-save is on.
Case1:Save()
I want TABLE1.ID=TABLE2.A and TABLE2.B='1' and TABLE2.C='2'
Case2:Get()
I want TABLE1.ID=TABLE2.A and TABLE2.B='1'and TABLE2.D='4'
How should i define this mapping?
Presently i have done like this :
Save is working fine... but when it comes to Get(), the sql query is:
select *
from TABLE1 t1 left outer join TABLE2 t2 on '1'= t2.A and '2'=t2.B and '3'=t2.C where t1.ID=?
which is incorrect...
Actually i want different joins for save() and get() respectively..... This is possible in JDBC but how i can achieve samething in
Hibernate ?