-->
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.  [ 9 posts ] 
Author Message
 Post subject: Reverse engineering: Association references unmapped class
PostPosted: Wed May 11, 2005 10:35 am 
Newbie

Joined: Wed May 11, 2005 10:28 am
Posts: 10
I am trying to use the Hibernate tools 3.0 to reverse engineer a database, and i get the following error:

org.hibernate.MappingException:Association references unmapped class:

followed by a class name

I don't quite understand what happens. Some classes will obviously not yet be mapped while mapping the others, so this shouldn't prevent reverse engineering from working, otherwise this tool would be impossible to use

Is this a bug or am I doing something wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 10:50 am 
Newbie

Joined: Wed May 11, 2005 10:28 am
Posts: 10
OK, I did spot the problem, but it still doesn't seem all right

The reverse engineering tool is stumbling upon many-to-many relationships implemented through association tables. This can be circumvented by adding primary keys to the association tables (and this is an ugly hack, actually)

Do the generated files need to be edited manually afterwards, in order to properly implement many-to-many relationships? (the generator replaces them with couples of one-to-many) Or is there a way to tell the generator how to interpret association tables?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 11:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
fixed in cvs where we use all the properties as an identifier if your table doesnt define a primary key.

(but may I ask why you dont have defined the primary key in the association tables since they ARE primary keys ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 5:10 pm 
Newbie

Joined: Wed May 11, 2005 10:28 am
Posts: 10
:)

you mean making the tuples composite primary keys?

that would be a less ugly hack, indeed. however, i'm only starting to use hibernate now, so i had no clue as to whether it would work

besides, the generator wouldn't produce out-of-the-box many-to-many relationships anyway, i suppose


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 5:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
nope not at the moment.

and yes - because they are a primary key for those association table.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: many-to-many associationship
PostPosted: Tue Nov 15, 2005 8:16 pm 
Regular
Regular

Joined: Fri Mar 04, 2005 1:33 pm
Posts: 65
Location: U.K.
Hi

When I reverse engineer a database which has a cross reference table (or in other words many to many relationship), the POJOs are not correct. The parent object A has reference to object CR which is a cross reference table and CR has a reference to both object A and B. I am using Hibernate-tools 3.1 beta.

Is this problem being resolved ?

Thanks
Ron


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 5:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
they are correct ;)

we don't support many-to-many (yet)

the reason: one of the biggest Hibernate FAQ's is how to add attributes to a many-to-many association table because very few db's have really pure many-to-many associations.

But patches are welcome - the code is in JDBCBinder and friends ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: many-to-many and H3
PostPosted: Wed Nov 16, 2005 10:28 am 
Regular
Regular

Joined: Fri Mar 04, 2005 1:33 pm
Posts: 65
Location: U.K.
Hi Max,

I hope you are saying many-to-many is not supported yet in Hibernate Tools and you are not referring to Hibernate 3 by any chance do you ?

Thanks
Ron


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 16, 2005 11:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
this is the tools forum so yes I am referring to the Hibernate Tools and not Hibernate core. ;)

_________________
Max
Don't forget to rate


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

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.