Hello All,
I have a many to one relationship between two object, which is working fine, except I wish to use a composite key, to match on but link on a single ID field. The reason I dont want to link on the composite key, is that I'll need ALL the fields of the second object included in the first object, which just so happens to be all of the fields in that object!
For example, Object A has this in its mapping file:
Code:
<many-to-one class="package.ObjectB" name="objectB" cascade="all" lazy="false" />
And Object B has:
Code:
<composite-id>
<key-property column="data" name="data"/>
<key-property column="more_data" name="moreData"/>
<key-property column="even_more_data" name="evenMoreData"/>
</composite-id>
Is there anyway I can have hibernate use a normal ID to link with (as in put that in the id field of the other table), but match records on the composite key?
I hope this make sense, and sorry if this has been asked before but Im unsure where to look for an answer.
Thanks,
Ben