Hi all,
It seems to me that bidirectional <one-to-one> association generates redundant foreign key
I have bidirectional 1-to-1 User-to-Person association by primary key:
<class name="model.User" table="user">
<id name="id">
<generator class="foreign">
<param name="property">person</param>
</generator>
</id>
<one-to-one name="person"
class="model.Person"
constrained="true"
/>
</class>
<class name="model.Person" table="person" discriminator-value="P">
<id name="id">
<generator class="native"/>
</id>
<discriminator column="subclass" type="character"/>
<one-to-one name="user" class="model.User"/>
</class>
and hibernate generates:
CREATE TABLE `user` (
`id` bigint(20) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK36EBCBA4230EF5` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Why does it need the KEY `FK36EBCBA4230EF5` (`id`) ?
|