Could Anyone could throw some hints for me to solve Repeated column in mapping for entity problem ?
My Database design is like below( could not change , it is from others) Table Clubs have Table Employees and Employeers through foreign primary key refereneced and depat_id are repeated ,
For mapping file of Club, i must set , insert and update to false. at lease for either Employeer or Employee. otherwise it will have repeated colum exception for Hibernate. but if i set eiter one for update and insert to false. i could not insert or update this record. How to solve this problem? Actually i just need Club to overwrite depat_id colum.
How to do it with Hibernate?
Thanks in advance for your input <many-to-one name="employeer" class="org.hibernate.test.Employeer" not-null="true" insert="false" update="false" >
CREATE TABLE EMPLOYEES ( depat_id int NOT NULL , employee_id int NOT NULL, salary decimal(20,4) NOT NULL, primary key (depat_id,employee_id) )
CREATE TABLE EMPLOYEERS ( depat_id int NOT NULL , employeer_id int NOT NULL, salary decimal(20,4) NOT NULL, primary key (depat_id,employeer_id) )
CREATE TABLE CLUBS( club_id int NOT NULL PRIMARY KEY, depat_id int NOT NULL , employee_id int NOT NULL, employeer_id int NOT NULL, foreign key (employee_id, depat_id) references employees (depat_id,employee_id), foreign key (employeer_id, depat_id) references employeers (depat_id,employeer_id) )