I've got a one-to-many unidirectional mapping:
Code:
<class name="OrgPage">
<id name="id">
<generator class="native"/>
</id>
<list name="links" table="linksToOrgPage" cascade="all-delete-orphan">
<key column="linkId"/>
<index column="position"/>
<one-to-many class="Link"/>
</list>
</class>
<class name="Link" table="links">
<id name="id">
<generator class="native"/>
</id>
<property name="url"/>
<property name="text"/>
<property name="description"/>
</class>
Not sure why, but instead of creating a join-table, position and linkId are added to the links table:
Code:
mysql> desc links;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | bigint(20) | | PRI | NULL | auto_increment |
| url | varchar(255) | YES | | NULL | |
| text | varchar(255) | YES | | NULL | |
| description | varchar(255) | YES | | NULL | |
| linkId | bigint(20) | YES | MUL | NULL | |
| position | int(11) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
Does anyone see what's wrong with this mapping?