-->
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.  [ 2 posts ] 
Author Message
 Post subject: OneToOne Bidirectional Join on Non-Primary Key
PostPosted: Tue Apr 25, 2017 12:28 am 
Newbie

Joined: Tue Apr 25, 2017 12:26 am
Posts: 4
I have two databases tables,

CREATE TABLE `company` (
`id` int(11) NOT NULL,
`company_id` int(11) NOT NULL,
`company_name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `company_id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

CREATE TABLE `employee` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`emp_id` int(11) NOT NULL,
`emp_name` varchar(255) NOT NULL,
`cmp_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

Now I want to add Bi-Directional OneToOne Join(on cmp_id which is non-primary key column).

How do I design my entities?


Top
 Profile  
 
 Post subject: Re: OneToOne Bidirectional Join on Non-Primary Key
PostPosted: Mon May 01, 2017 3:05 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1638
Location: Romania
What have you tried so far?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.