| 
					
						 Hello!
 
 I have mapped 2 many to many tables together over a third.
 The example is like this (mysql is used):
 
 -- ------------------------------------------------------------
 -- This Query shows all workers and their assignment ( not showing how many hours ).
 -- 
 -- select j.object,w.firstname,w.lastname
 -- from job j,job_x_worker x,worker w
 -- where j.job_id=x.job_id
 -- and x.worker_id=w.worker_id
 -- ------------------------------------------------------------
 
 CREATE TABLE job (
   job_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
   orderer_person_id INTEGER(10) UNSIGNED NOT NULL,
   object VARCHAR(255) NULL,
   ordernr VARCHAR(45) NULL,
   folder VARCHAR(45) NULL,
   PRIMARY KEY(job_id),
   INDEX job_FKIndex1(orderer_person_id)
 );
 
 CREATE TABLE job_x_worker (
   id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
   worker_id INTEGER(10) UNSIGNED NOT NULL,
   job_id INTEGER(10) UNSIGNED NOT NULL,
   hours INTEGER UNSIGNED NULL,
   date DATETIME NULL,
   PRIMARY KEY(id),
   INDEX work_x_assembler_FKIndex1(job_id),
   INDEX work_x_assembler_FKIndex2(worker_id)
 );
 
 
 CREATE TABLE worker (
   worker_id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
   firstname VARCHAR(45) NOT NULL,
   lastname VARCHAR(45) NOT NULL,
   PRIMARY KEY(worker_id)
 );
 
 
 I have mapped this in a nice manner, so I am able to link a job to a worker and soforth ... using struts and a poor-layout to do the trick.
 I create a job in my jsp.
 On another Jsp, where the workers are I can see a drop down list with all the works - there I do my link ( I link workers to jobs).
 
 But I really do not know on how to map my job_x_worker table, so I am not filling out how many hours the worker is doing the job - this could be done in the end of each week, the employee fills out the hours.
 
 does someone have a nice feature here ...
 
 I am new to hibernate.
 this project is done do get more friendly with hibernate and struts,.
 
 regards, i 
					
  
						
					 |