-->
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.  [ 1 post ] 
Author Message
 Post subject: <many-to-one> should reference NOT to the Primarykey-H
PostPosted: Mon Dec 19, 2005 9:43 am 
Newbie

Joined: Wed Sep 28, 2005 5:05 am
Posts: 11
Hi ;)
I´m using Hibernate 2.8.1 and MicrosoftSQL-Server.
My problem:
I have two tables with a one-to-many relation:

Table 1
Name: Adressen
Primary Key: __Org_RecordNo
column:Name (String36)
column:Number(int)

Table2
Name: Ansprechpartner
Primary Key: __Org_RecordNo
Foreign Key: AdressID
Column: Name(String36)

if i use the "normal" mapping the relation looks like this:
Mapping for Adressen:
...
<set inverse="true" name="AnsprechpartnerSet">
<key column ="AdressID"/>
<one-to-many class="Ansprechpartner"/>
</set>
I think that works fantastic. Now comes the PROBLEM:
The return-mapping from Ansprechpartner:
...
<many-to-one
name="Adressen"
column="AdressID"
class="Adressen"/>

That means, AdressID from Ansprechpartner references to __Org_RecordNo(PrimaryKey) from Adressen. But it have to show to the column Number of Adressen not to the primary key...a little confuse..but thats the given situation..

How can i map this?


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

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.