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?
|