-->
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: Mapping 2 or more foreign-keys as set of primary-keys
PostPosted: Thu Sep 06, 2007 11:10 am 
Newbie

Joined: Thu Sep 06, 2007 10:44 am
Posts: 2
Hi,

is it possible to map following tables:

Table1
PK1 --Primary key (PK)
PKFK1 -- Primary and foreign key
PKFK2

Table2
PK1
PK2

PKFK1 and PKFK2 is foreign-key and primary-key in table1 and primary-key in table2
Is it possible to map this tables in hibernate?
<composite-id
name="id"
class="Table1PK">
<key-property name="PK" column="PK1" type="type" />
<key-many-to-one name="PKFK1" class="Table2Bean" />
<key-many-to-one name="PKFK2" class="Table2Bean "/>
</composite-id>

My tries could not map the table1.

Thanks for help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 12:12 pm 
Regular
Regular

Joined: Thu Oct 19, 2006 12:07 pm
Posts: 75
Try this :

Code:
<composite-id name="id" class="Table1PK">
    <key-property name="PK" column="PK1" type="type" />
    <key-many-to-one name="theBean" class="Table2Bean" />
        <column name="PKFK1" />
        <column name="PKFK2"/>
    </key-many-to-one>
</composite-id>


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.