Hello,
it's this relation i want to map :
My mapping (just the association class)
Code:
<set name="predecessors" table="workorder" lazy="true" inverse="true">
<cache usage="read-write"/>
<key column="predecessor_id" />
<composite-element class="wilos.model.spem2.workbreakdownelement.WorkOrder">
<many-to-one name="successor" class="wilos.model.spem2.workbreakdownelement.WorkBreakdownElement"
column="successor_id">
</many-to-one>
</composite-element>
</set>
<set name="successors" table="workorder" lazy="true">
<cache usage="read-write"/>
<key column="successor_id" />
<composite-element class="wilos.model.spem2.workbreakdownelement.WorkOrder">
<property name="linkType" type="java.lang.String"
column="linktype" />
<many-to-one name="predecessor" class="wilos.model.spem2.workbreakdownelement.WorkBreakdownElement"
column="predecessor_id">
</many-to-one>
</composite-element>
</set>
Normally, WorkOrder should have the columns predecessor_id and successor_id (both are others names of the column workbreakdownelement_id which is the primary key of workbreakdownelement table) as primary key
My problem is, in my database (i use MySQL), the WorkOrder table has no primary key (underlined columns), just predecessor_id column has null property to false but not successor_id (true) whereas it should be in the primary key.
I have to make a mistake in my mapping but i don't see where ...
Can anyone help me ?