My setup is below. I'm wondering how I can setup a mapping document given the table definitions I have. As you see the JOIN table gems_partner_activity table contains partner_id and activity_id, so that I can specify a bi-directional relationship for both partner and activity relationships (Partner has Activities and Activities have Partners defined).
In addition, however, there are three values in the JOIN table ( hold_transmission, transmit_realtime, and scheduler_name), which belong exclusively to the unique combination of partner and activity combination and they do not make sense outside of that relationship.
How do I create a mapping file to propertly represent them in a Domain Object Model that will be generated?
Here is my setup:
Hibernate version 3.2
DB is MySQL41
Table definitions DDL:
# Partner table definition
CREATE TABLE gems_partner (
partner_id INTEGER NOT NULL,
name VARCHAR(255) NOT NULL,
PRIMARY KEY (partner_id)
);
CREATE TABLE gems_activity (
activity_id INTEGER NOT NULL,
name VARCHAR(255) NOT NULL,
fullpath VARCHAR (255) NOT NULL,
PRIMARY KEY (activity_id)
);
# This is the JOIN table for Activity and Partner
CREATE TABLE gems_partner_activity (
partner_id INTEGER NOT NULL,
activity_id INTEGER NOT NULL,
hold_transmission boolean,
transmit_realtime boolean,
scheduler_name varchar(255),
PRIMARY KEY (partner_id, activity_id),
FOREIGN KEY (partner_id)
REFERENCES gems_partner(partner_id),
FOREIGN KEY (activity_id)
REFERENCES gems_activity(activity_id),
INDEX partner_ind(partner_id),
INDEX activity_ind(activity_id)
);
|