Hi all,
Actually, i've got 3 tables (in an Oracle database) and i can't find the way to write their mappings.
I want to represent the primaries keys of thes tables.
The structure looks like this :
TASQUES_DOCUMENTS ------ DOCUMENTS
TTD_SYS ------------------------ TDO_SYS
TDO_CODI-------------------- TDO_CODI
TTQ_CODI
TASQUES_DOCUMENTS --- TASQUES
TTD_SYS ------------------ TTQ_SYS
TDO_CODI
TTQ_CODI ---------------- TTQ_CODI
So i defined DOCUMENTS:
Code:
<hibernate-mapping package="net.gencat.uid.model.param.document">
<class
name="Document"
table="UIDT_DOCUMENTS">
<composite-id>
<key-property name="dosys" column="TDO_SYS" />
<key-property name="docodi" column="TDO_CODI" />
</composite-id>
</class>
</hibernate-mapping>
and then TASQUES :
Code:
<hibernate-mapping package="net.gencat.uid.model.param.tasca">
<class
name="Tasca"
table="UIDT_TASQUES">
<composite-id>
<key-property name="tqsys" column="TTQ_SYS" />
<key-property name="tqcodi" column="TTQ_CODI" />
</composite-id>
<set name="tascaDocuments" inverse="true" lazy="true" order-by="TDO_CODI">
<key>
<column name="TTQ_CODI"/>
<column name="TTQ_SYS"/>
</key>
<one-to-many class="net.gencat.uid.model.param.tasca.TascaDocument"/>
</set>
</class>
</hibernate-mapping>
and the last mapping TASQUES_DOCUMENTS :
Code:
<hibernate-mapping package="net.gencat.uid.model.param.tasca" >
<class
name="TascaDocument"
table="UIDT_TASQUES_DOCUMENTS">
<composite-id name="id" class="TascaDocumentPK">
<key-property name="tdsys" column="TTD_SYS"/>
<key-many-to-one name="tasca"
class="net.gencat.uid.model.param.tasca.Tasca">
<column name="TTQ_SYS"/>
<column name="TTQ_CODI"/>
</key-many-to-one>
<key-many-to-one name="document"
class="net.gencat.uid.model.param.document.Document">
<column name="TDO_SYS"/>
<column name="TDO_CODI"/>
</key-many-to-one>
</composite-id>
</class>
</hibernate-mapping>
Certainly, you understood my problem is related to the last mapping. When i'm trying to acces to TascaDocument with the set tascaDocuments of Tasques,
the system throw an SQLGrammarxception. Probably because my mapping isn't correct.
I did have created all asociated classes, included the class which contains the primary key of Tasques_Documents
Any idea ?