Hibernate version: 3.1.3
Hello all
i have the following database table definition:
Code:
* KursEdit * Coach -- Stellvertreter
* KursAdd * mapping tabelle * Leiter / \
+-------------+ +---------------+ +-------------+ m:m +----------+ m:m +------------+
| TRANSAKTION |<----->| TBERECHTIGUNG |<----->| TTAETIGKEIT |<----->| TPROFIL |<----->| TBENUTZER |
+-------------+ +---------------+ +-------------+ +----------+ +------------+
\ / * Kurs erfassen * Angela
\ +-----------+ / * Anwesenheitskontrolle * Thomas
--- | TAKTION |---
+-----------+
TBERECHTIGUNG is a mapping table which contains foreign keys to TAKTION, TTAETIGKEIT und TTRANSAKTION. These three foreign keys are also building a composite id.
Code:
CREATE TABLE "TBERECHTIGUNG" (
"FK_TTAETIGKEIT_ILAUFNR" NUMBER NOT NULL ENABLE,
"FK_TTRANSAKTION_ILAUFNR" NUMBER NOT NULL ENABLE,
"FK_TAKTION_ILAUFNR" NUMBER NOT NULL ENABLE,
CONSTRAINT "PK_TBERECHTIGUNG" PRIMARY KEY ("FK_TTAETIGKEIT_ILAUFNR", "FK_TTRANSAKTION_ILAUFNR", "FK_TAKTION_ILAUFNR") ENABLE,
CONSTRAINT "TBERECHTIGUNG_FK" FOREIGN KEY ("FK_TTAETIGKEIT_ILAUFNR")
REFERENCES "TTAETIGKEIT" ("ILAUFNUMMER") DEFERRABLE INITIALLY DEFERRED DISABLE,
CONSTRAINT "TBERECHTIGUNG_FK2" FOREIGN KEY ("FK_TTRANSAKTION_ILAUFNR")
REFERENCES "TTRANSAKTION" ("ILAUFNUMMER") DEFERRABLE INITIALLY DEFERRED DISABLE,
CONSTRAINT "TBERECHTIGUNG_FK3" FOREIGN KEY ("FK_TAKTION_ILAUFNR")
REFERENCES "TAKTION" ("ILAUFNUMMER") DEFERRABLE INITIALLY DEFERRED DISABLE
);
How do i have to define this mapping???
I already did the mapping for TBENUTZER, TPROFIL and TTAETIGKEIT, there are mapping tables in between with only two foreign-keys, which i specified like that for example (Benutzer.hbm.xml):
Code:
<set name="profile" table="TBENU_PROFIL" fetch="join" cascade="all" >
<key column="FK_TBENU_ILAUFNR" />
<many-to-many column="FK_TPROFIL_ILAUFNR" class="najsre7.model.Profil" />
</set>
Any help appreciated...
kind regards
angela