-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem with the mapping of an association class
PostPosted: Fri May 25, 2007 6:03 pm 
Newbie

Joined: Thu Dec 07, 2006 4:11 pm
Posts: 12
Hello,

it's this relation i want to map :

Image

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 ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.