Hi all
I am trying to do this:
I have a Message object, which has a TypeId
I have a Data table, which has a EntityId and a UniqueId as primary keys.
It also has an EntityName field.
I would like to join between the two - get Message to have an EntityName field with the value from Data.
I tried creating a <many-to-one> or <one-to-one> mapping between Message and Data, but Hibernate doesn't allow that since I am using ONE foreign key as opposed to TWO primary keys. Plus, I'd like to retrieve only the entity name and not the entire Data object, if possible.
Any ideas?
Thanks
Code:
--message object---
<property name="MessageType" column="EntityId" length="36"/>
<many-to-one name="repository" class="DataObject" column="EntityId" insert="false" update="false"/>
---data object
<composite-id>
<key-property name="EntityId" length="36"/>
<key-property name="VersionUID" length="36"/>
</composite-id>
<property name="EntityName" length="100"/>