-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-many with savings in the bridge!?
PostPosted: Fri Oct 06, 2006 7:43 pm 
Newbie

Joined: Sat Jun 24, 2006 6:26 pm
Posts: 10
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.