spring - Hibernate Mysql mapping relationship -
i'm not sure if possible in spring 3 framework using hibernate , mysql appreciate help. have 2 classes - employee , examiner. examiner employee , employee examiner. @ same time each examiner can examine 1 or more employees , employee can have 1 examiner.
basically want know if possible show inheritance between employee , examiner, , @ same time map unidirectional 1 many examiner employee?
what have far - examiner table inheritance constraint:
create table `examiner` ( `employee_id` varchar(255) not null, `employee_name` varchar(255) not null, primary key (`enployee_id`), foreign key (`employee_id`) references `employee` (`employee_id`)):
the employee table:
create table `employee` ( `employee_id` varchar(255) not null, `employee_name` varchar(255) default null, primary key (`employee_id`)):
i thinking of join table showing 1 many behaviour getting compsite key table not possible have primarykeyjoin column.
i appreciate in pulling have been stumped days.
java doesn't allow multiple inheritance, unless using interface not sure how plan make 2 described classes instances of each other.
you make class called employeeexaminer, , make reference itself. annotations might like:
@entity public class employeeexaminer { @manytoone private employeeexaminer getexaminer() {/*...*/} @onetomany private list<employeeexaminer> getemployees() { /*...*/} }
documentation on annotations can found here.
Comments
Post a Comment