-->
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: one-to-one generates redundant foreign key?
PostPosted: Wed May 31, 2006 8:06 am 
Newbie

Joined: Wed May 31, 2006 7:48 am
Posts: 1
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`) ?


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.