Hallo,
I'have two tables PERSONS and TITLES
PERSONS has a FK column "TITLE_ID" to give each person a title (like Mr., Mrs. ...). TITLE_ID is the id in TITLES and not the PERSONS.ID.
Now I want to map a Person with an property like getTitle() giving me back a String and not an Title object. So a have used the <join> tag in the Person mapping:
<class name="Person" table="PERSONS">
...
<join table="TITLES" optional="true">
<key column="TITLE_ID" />
<property name="title" column="TEXT"></property>
</join>
...
</class>
Hibernate creates a SQL script like
select ... from
persons p
left outer join titles t on p.id=t.title_id
But I want to have
select ... from
persons p
left outer join titles t on p.title_id=t.id
When I think of an FK join I'm coming from the table holding the FK!?
Is there any way to map such an association?
Thank's.
atsch
|