sagimann wrote:
During the hibernate init stages?
no, only if i execute the query.
I created a additional mapping file now for TBERECHTIGUNG:
Code:
<hibernate-mapping>
<class name="najsre7.model.Berechtigung" table="TBERECHTIGUNG" >
<composite-id>
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<key-many-to-one name="taetigkeit" class="najsre7.model.Taetigkeit" column="FK_TTAETIGKEIT_ILAUFNR" />
<key-many-to-one name="transaktion" class="najsre7.model.Transaktion" column="FK_TTRANSAKTION_ILAUFNR" />
<key-many-to-one name="aktion" class="najsre7.model.Aktion" column="FK_TAKTION_ILAUFNR" />
</composite-id>
<timestamp name="mutDatum" column="DMUTDAT" />
<property name="mutUser" type="java.lang.String">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="SMUTUSER" length="10" not-null="true" />
</property>
<property name="stvUser" type="java.lang.String">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="SSTVUSER" length="10" />
</property>
<many-to-one name="aktion" class="najsre7.model.Aktion" column="FK_TAKTION_ILAUFNR" lazy="false" fetch="join" insert="false" update="false"/>
<many-to-one name="taetigkeit" class="najsre7.model.Taetigkeit" column="FK_TTAETIGKEIT_ILAUFNR" lazy="false" fetch="join" insert="false" update="false"/>
<many-to-one name="transaktion" class="najsre7.model.Transaktion" column="FK_TTRANSAKTION_ILAUFNR" lazy="false" fetch="join" insert="false" update="false"/>
</class>
</hibernate-mapping>
Taetigkeit.hbm.xml:
Code:
<set name="berechtigungen" inverse="true" cascade="persist,merge,save-update">
<key column="FK_TTAETIGKEIT_ILAUFNR" />
<many-to-many class="najsre7.model.Berechtigung" />
</set>
But then i get the following error while starting:
Code:
2006-08-07 10:27:33,313 ERROR Servlet /ndbjsre7 threw load() exception in (StandardContext.java:3919)
org.hibernate.MappingException: Foreign key (FKEB00DA60FF9481EF:berechtigungen [elt])) must have same number of columns as the referenced primary key (TBERECHTIGUNG [FK_TTRANSAKTION_ILAUFNR,DMUTDAT,SMUTUSER])
These are my tables:
Table TBERECHTIGUNG:
- FK_TAKTION_ILAUFNR
- FK_TTAETIGKEIT_ILAUFNR
- FK_TTRANSAKTION_ILAUFNR
- MUTUSER
- MUTDAT
Table TTRANSAKTION:
- ILAUFNUMMER
- STRANSAKTION
- MUTUSER
- MUTDAT
Table TAKTION
- ILAUFNUMMER
- SAKTION
- MUTUSER
- MUTDAT
Table TRANSAKTION_TAKTION:
- FK_TAKTION_ILAUFNR
- FK_TTRANSAKTION_ILAUFNR
- MUTUSER
- MUTDAT
Table TTAETIGKEIT
- ILAUFNUMMER
- SAKTION
- MUTUSER
- MUTDAT
How should my mappings look like?
Regards Angela