-->
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: Avoid Repeated column in mapping for collection ?
PostPosted: Thu Sep 11, 2008 6:08 am 
Newbie

Joined: Thu Sep 11, 2008 5:37 am
Posts: 1
Hello how can i get rid off this Repeated column error?

Person and Sport in a n..m asociation
I want in Person a HashMap of Sport where the key is the idSport and the elements are Sports

I have the tables Person,Sport and Persons_Sports(idPerson,idSport) for the n..m asociation
Code:
<hibernate-mapping>
  <class name="Person >
    <id column="Id" name="id" type="integer">
      <generator class="identity"/>
    </id>
    <natural-id>
      <property name="dni" type="string" unique="true"/>
    </natural-id>
    <property name="nombre" type="string"/>
     <property name="email" type="string"/>
    <property name="empresa" type="string"/>
    <map name="sports" table="Persons_Sports" cascade="all">
      <key column="idPerson"/>
      <map-key column="idSport" type="string" />
      <many-to-many class="Sport" column="idSport"/>
    </map>


Code:
<hibernate-mapping>
  <class name="Sport">
    <id column="Id" name="id" type="integer">
      <generator class="assigned"/>
    </id>
    <property column="texto_cas" name="textoCas" type="string"/>
    <property column="texto_eus" name="textoEus" type="string"/>
    <set inverse="true" name="persons" table="Persons_Sports">
      <key column="idSport"/>
      <many-to-many class="Person" column="idPerson"/>
    </set>
  </class>
</hibernate-mapping>


Cause in Person.hbm.xml the idSport is used in the map-key and in the many-to-may I get a Repeated column in mapping for collection error.

Thanks a Lot


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.