-->
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 mehrerer Foreign-keys die zugleich Primarykeys sind
PostPosted: Thu Sep 06, 2007 10:54 am 
Newbie

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

Habe folgende Situation:

Tabelle1
PK1
PKFK1
PKFK2


Tabelle2
PK1
PK2


PK1 PKFK1 und PKFK2 bilden den Primary Key der Tabelle1
PKFK1 und PKFK2 sind Foreign Keys auf PK1 PK2 Tabelle2

Kann man diese Tabellenstruktur irgendwie in Hibernate mappen?
<composite-id
name="id"
class="Tabelle1PK">
<key-property name="PK" column="PK1" type="type" />
<key-many-to-one name="PKFK1" class="Tabelle2Bean" />
<key-many-to-one name="PKFK2" class="Tabelle2Bean "/>
</composite-id>

Mein Versuch geht auf alle Fälle mal nicht.

Danke für eure Hilfe.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 6:02 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
composite-id mit key-property für jedes Attribut des ID. Die key-many... brauchst Du dort nicht.

In der anderen Tabelle eine Beziehung erstellen und in der gleichen Reihenfolge die fkey Spalten konfigurieren. Du must wieder alle Spalten aufführen.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.