It's been about 4 years since I've done anything with Hibernate, so I'm very rusty. I have the following schema as an example:
create table employee ( id integer primary key auto_increment, name varchar(64) not null, job_title integer not null );
create table job_title ( id integer primary key auto_increment, name varchar(64) );
create table employee_job_title ( id integer primary key auto_increment, title_id integer not null, employee_id integer not null );
alter table employee_job_title add foreign key(title_id) references job_title(id); alter table employee_job_title add foreign key(employee_id) references employee(id);
Assuming I have a class "Employee" with a method like setJobTitle(JobTitle title), how would I set up the mappings for Employee and JobTitle so that it would link them through the employee_job_title table?
|