Joined: Tue Jul 07, 2009 2:01 pm Posts: 2
|
Hello There
I have two tables like this table 1 PK attr1 attr2 PKField_1 - From table 2 it is one-to-many relationship to table 2
table 2 PKField_1 PKField_2 Attr1 Attr2
PKField_1 and PKField_2 are composite PK field.
I am trying to mapping table 2 in table 1 like <class name="table1class" ..... <set name="PKField1"> <key> <column name="PKField_1" /> </key> <one-to-many class="table2class" /> </set> ....
in table1class.java I have set<table2class> getPKField1() method and the setter method
But hibernate can not return any objects from getPKField1() method. I checked the set return from this mehod, it is empty.
The document said the key column in here must be FK which mean it must be primary key of table2 in my case. my question is how can i association two tables but just use a common column rather than FK column or columns. Does HIbernate support this way?
thank you very much!
|
|