Peter Hulst
2004-11-04 20:17:46 UTC
I'm trying to declare a many2many relationship with Middlegen and the
Hibernate plugin but for some reason it doesn't work.
I'm getting the message 'The many2many relation
COUNTRIES-REGIONS_HAS_COUNTRIES-REGIONS was declared, but not identified. '
In the Middlegen gui, both tables show up but no relation is displayed. All
other one-to-many and one-to-one relationships display just fine
I have a many-to-many relationship between countries and regions and the
mapping in my build file looks like this:
<many2many>
<tablea name="REGIONS"/>
<jointable name="REGIONS_HAS_COUNTRIES" generate="false"/>
<tableb name="COUNTRIES"/>
</many2many>
The regions_has_countries table is generated as follows (using dbdesigner4)
CREATE TABLE REGIONS_has_COUNTRIES (
REGION_ID INTEGER UNSIGNED NOT NULL,
COUNTRY_ID INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(REGION_ID, COUNTRY_ID),
INDEX REGIONS_has_COUNTRIES_FKIndex1(REGION_ID),
INDEX REGIONS_has_COUNTRIES_FKIndex2(COUNTRY_ID),
FOREIGN KEY regions_countries_link(REGION_ID)
REFERENCES REGIONS(REGION_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY countries_regions_link(COUNTRY_ID)
REFERENCES COUNTRIES(COUNTRY_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
TYPE=InnoDB;
so as far as I'm aware the foreign keys and indexes have been defined
correctly.
I'm using MySQL 4.1.5-gamma-nt, JDBC driver
mysql-connector-java-3.0.15-ga-bin.jar, middlegen 2.1
any help/suggestions appreciated,
thanks Peter
Hibernate plugin but for some reason it doesn't work.
I'm getting the message 'The many2many relation
COUNTRIES-REGIONS_HAS_COUNTRIES-REGIONS was declared, but not identified. '
In the Middlegen gui, both tables show up but no relation is displayed. All
other one-to-many and one-to-one relationships display just fine
I have a many-to-many relationship between countries and regions and the
mapping in my build file looks like this:
<many2many>
<tablea name="REGIONS"/>
<jointable name="REGIONS_HAS_COUNTRIES" generate="false"/>
<tableb name="COUNTRIES"/>
</many2many>
The regions_has_countries table is generated as follows (using dbdesigner4)
CREATE TABLE REGIONS_has_COUNTRIES (
REGION_ID INTEGER UNSIGNED NOT NULL,
COUNTRY_ID INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(REGION_ID, COUNTRY_ID),
INDEX REGIONS_has_COUNTRIES_FKIndex1(REGION_ID),
INDEX REGIONS_has_COUNTRIES_FKIndex2(COUNTRY_ID),
FOREIGN KEY regions_countries_link(REGION_ID)
REFERENCES REGIONS(REGION_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
FOREIGN KEY countries_regions_link(COUNTRY_ID)
REFERENCES COUNTRIES(COUNTRY_ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
TYPE=InnoDB;
so as far as I'm aware the foreign keys and indexes have been defined
correctly.
I'm using MySQL 4.1.5-gamma-nt, JDBC driver
mysql-connector-java-3.0.15-ga-bin.jar, middlegen 2.1
any help/suggestions appreciated,
thanks Peter