-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: I don't understand the <join> tag!?
PostPosted: Fri Jul 22, 2005 10:43 am 
Newbie

Joined: Fri Jul 22, 2005 10:14 am
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 10:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No. <key property-ref> is not yet supported for <join>.

Use <many-to-one>.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.