Hi all
I'm wondering how i can define propertie names of foreignkeys, which are building a composite id as well. I have 3 tables:
TBENUTZER
TPROFILE
TBENU_PROFIL_MATRIX
Table TBENUTZER contains all registered users, table TPROFILES all defined profiles and table TBENU_PROFIL_MATRIX is a matrix table which connects the benutzer with profiles.
TBENU_PROFIL_MATRIX only contains 2 columns, a foreign-key to TBENUTZER and a foreign-key to TPROFILE. Those foreign-key are building a composite ID of this table.
Now i was trying to define the properties in the reveng.xml file. My file looks like that:
Code:
<table schema="NAJSRE7_WEB" name="TBENUTZER" class="najsre7.model.Benutzer">
<primary-key>
<generator class="sequence">
<param name="sequence">SEQ_TBENUTZER</param>
</generator>
<key-column name="ILAUFNUMMER" property="id" />
</primary-key>
<column name="SBENUTZERNAME" jdbc-type='' property="benutzerName" />
<column name="SPASSWORT" jdbc-type='' property="passwort" />
<column name="SEMAIL" jdbc-type='' property="eMail" />
<column name="DLASTLOGIN" jdbc-type='' property="lastLogin" />
<column name="IANZLOGIN" jdbc-type='' property="anzahlLogin" />
<column name="SMUTUSER" jdbc-type='' property="mutUser" />
<column name="SSTVUSER" jdbc-type='' property="stvUser" />
<column name="DMUTDAT" jdbc-type='' property="mutDatum" />
<column name="FK_TPER_IPERSNR" jdbc-type='' property="personId" />
<foreign-key constraint-name="FK_TBENUSTAT_ISTATUS">
<column-ref local-column="FK_TBENUSTAT_ISTATUS" foreign-column="ISTATUS" />
<many-to-one property="benutzerStatus" />
<set property="benutzer" />
</foreign-key>
</table>
<table schema="NAJSRE7_WEB" name="TBENU_PROFIL_MATRIX" class="najsre7.model.BenutzerProfil">
<primary-key>
<key-column name="FK_TBENU_ILAUFNR" property="benutzer" />
<key-column name="FK_TPROFIL_ILAUFNR" property="profil" />
</primary-key>
<foreign-key constraint-name="FK_TBENU_ILAUFNR">
<column-ref local-column="FK_TBENU_ILAUFNR" foreign-column="ILAUFNUMMER" />
<many-to-one property="benutzer" />
<set property="profile" />
</foreign-key>
<foreign-key constraint-name="FK_TPROFIL_ILAUFNR">
<column-ref local-column="FK_TPROFIL_ILAUFNR" foreign-column="ILAUFNUMMER" />
<many-to-one property="profil" />
<set property="benutzer" />
</foreign-key>
</table>
<table schema="NAJSRE7_WEB" name="TPROFILE" class="najsre7.model.Profil">
<primary-key>
<generator class="sequence">
<param name="sequence">SEQ_TPROFILE</param>
</generator>
<key-column name="ILAUFNUMMER" property="id" />
</primary-key>
<column name="SPROFIL" jdbc-type='' property="profilName" />
<column name="SBESCHREIBUNG" jdbc-type='' property="beschreibung" />
<column name="SMUTUSER" jdbc-type='' property="mutUser" />
<column name="SSTVUSER" jdbc-type='' property="stvUser" />
<column name="DMUTDAT" jdbc-type='' property="mutDatum" />
</table>
The generated BenutzerProfil hibernate mapping file looks like that:
Code:
<hibernate-mapping>
<class name="najsre7.model.BenutzerProfil" table="TBENU_PROFIL_MATRIX" schema="NAJSRE7_WEB">
<composite-id name="id" class="najsre7.model.BenutzerProfilId">
<key-many-to-one name="tbenutzer" class="najsre7.model.Benutzer">
<column name="FK_TBENU_ILAUFNR" precision="22" scale="0" />
</key-many-to-one>
<key-many-to-one name="tprofile" class="najsre7.model.Profil">
<column name="FK_TPROFIL_ILAUFNR" precision="22" scale="0" />
</key-many-to-one>
</composite-id>
</class>
</hibernate-mapping>
so how can i define the both properties? now they have the names tbenutzer and tprofile, these i would like to change. Or is there a better solution to handle such a matrix table?
Kind regards
angela