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