-->
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: Reverse engineering exception unmapped class
PostPosted: Wed Jan 28, 2009 2:01 pm 
Newbie

Joined: Wed Jan 28, 2009 1:26 pm
Posts: 1
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


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.