How should I do if I have two tables and their primary keys have the same name like the following XML mapping file suggests?
<class name="Person" table="person">
<id name="uid_" type="java.lang.String" column="uid">
<generator class="native" />
</id>
<property name="name_" type="java.lang.String" column="pName" />
<property name="age_" type="integer" column="age" />
<property name="birthday_" type="date" column="birthday"/>
<many-to-one name="school" class="School" column="schoolID" unique="false" />
<bag name="course">
<key column="uid" />
<many-to-many class="Course" column="uid" />
</bag>
</class>
The Person and Course’s primary key both named “uid”. The hibernate says “Repeated column in mapping”.
Change the name given to the column in the many to many relation.
The column in the relation mapping isn’t an identifier of the course’s column, it is just the name to be used in the relation table.