I´m having trouble reverse engineering a database that uses a third table (a_m_z) to associate other two (a_m and z).
If i disable detection of "many to many" tables works fine, but i would like to generate with it enabled so the
classes generated are simpler.
Error:
org.hibernate.MappingException An association from the table a_m_z refers to an unmapped class: AZ (a_z)
couldn't find where the problem is,
I have the following Database tables:
CREATE TABLE a (
a_id numeric(9,0) NOT NULL
);
ALTER TABLE ONLY a
ADD CONSTRAINT pk_a PRIMARY KEY (a_id);
CREATE TABLE a_m (
m character varying(20) NOT NULL,
a_id numeric(9,0) NOT NULL
);
ALTER TABLE ONLY a_m
ADD CONSTRAINT pk_a_m PRIMARY KEY (m);
CREATE TABLE a_m_z (
a_id numeric(9,0) NOT NULL,
z_id numeric(9,0) NOT NULL,
m character varying(20) NOT NULL
);
ALTER TABLE ONLY a_m_z
ADD CONSTRAINT pk_a_m_z PRIMARY KEY (a_id, z_id, m);
CREATE TABLE a_z (
a_id numeric(9,0) NOT NULL,
z_id numeric(9,0) NOT NULL
);
ALTER TABLE ONLY a_z
ADD CONSTRAINT pk_a_z PRIMARY KEY (a_id, z_id);
CREATE TABLE z (
z_id numeric(9,0) NOT NULL
);
ALTER TABLE ONLY z
ADD CONSTRAINT z_pkey PRIMARY KEY (z_id);
ALTER TABLE ONLY a_m
ADD CONSTRAINT fk_a_mo_reference_a FOREIGN KEY (a_id) REFERENCES a(a_id);
ALTER TABLE ONLY a_m_z
ADD CONSTRAINT fk_a_mo_reference_a_m FOREIGN KEY (m) REFERENCES a_m(m);
ALTER TABLE ONLY a_m_z
ADD CONSTRAINT fk_a_mo_reference_a_zo FOREIGN KEY (a_id, z_id) REFERENCES a_z(a_id, z_id);
ALTER TABLE ONLY a_z
ADD CONSTRAINT fk_a_zo_reference_a FOREIGN KEY (a_id) REFERENCES a(a_id);
ALTER TABLE ONLY a_z
ADD CONSTRAINT fk_a_zo_reference_z FOREIGN KEY (z_id) REFERENCES z(z_id);
Hibernate Version : Latest from Site (3)
Hibernate Tools : Latest from Site
Any help????
Sebastian
|