0

I have a OneToOne relationship like this :-

Person                            Others
-----------                      ------------- 
| id  (PK) |  <----------------->| id(PK)(FK) |
-----------                      -------------
| name     |                     |....        |
| address  |                     |....        |
| ....     |                     |....        |

Here person table's id is auto-generated, but Others table's id is a foreign key. How can I link these two tables.

Arthur Ronald
  • 33,349
  • 20
  • 110
  • 136
harish
  • 21
  • 2
  • possible duplicate of [@PrimaryKeyJoinColumn with Bidirectional @OneToOne relationship ](http://stackoverflow.com/questions/2001007/primarykeyjoincolumn-with-bidirectional-onetoone-relationship) – Arthur Ronald Aug 16 '10 at 06:48
  • See also [JPA Hibernate One-to-One relationship](http://stackoverflow.com/questions/787698/jpa-hibernate-one-to-one-relationship) – Pascal Thivent Aug 17 '10 at 04:43

1 Answers1

0

You can forget about the foreign key stuff and keep coninue in normal one to one mapping relation.For more details how to connect two tables when one has no primary key

Sanjaya Liyanage
  • 4,706
  • 9
  • 36
  • 50