-->
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.  [ 10 posts ] 
Author Message
 Post subject: Reverse Engineering Unmaped Class Exception
PostPosted: Mon Jan 21, 2008 12:48 pm 
Newbie

Joined: Mon Jan 21, 2008 11:05 am
Posts: 5
Hello,


I’m having some serious problems with the Hibernate reverse engineering process. I’ve tried the process with PostgreSQL and Mysql and both result in the same error.

I defined a DB in the EA then proceeded to its code generation. I have no problem using the script to create the DB in either the Database systems.

But when I try to generate the code with reverse engineer I get the same error code:



org.hibernate.MappingException: An association from the table restriction refers to an unmapped class: TargetReportingdata



Hibernate version: 3.2.0GA

Mapping documents: The tables i am having problems with are:

CREATE TABLE target_reportingdata
(
targetdef_id INTEGER NOT NULL,
reportingdatadef_id INTEGER NOT NULL,
PRIMARY KEY (targetdef_id, reportingdatadef_id),
KEY (reportingdatadef_id),
KEY (targetdef_id)
)
;

and

CREATE TABLE restriction
(
id INTEGER NOT NULL,
targetdef_id INTEGER NOT NULL,
reportingdatadef_id INTEGER NOT NULL,
restrictiontype_id INTEGER NOT NULL,
restriction_value INTEGER NOT NULL,
description VARCHAR(100),
eventdef_id INTEGER NOT NULL,
PRIMARY KEY (id),
KEY (eventdef_id),
KEY (restrictiontype_id),
KEY (targetdef_id, reportingdatadef_id)
)
;

ALTER TABLE restriction ADD CONSTRAINT FK_restriction_target_reportingdata
FOREIGN KEY (targetdef_id, reportingdatadef_id) REFERENCES target_reportingdata (targetdef_id, reportingdatadef_id)
;


Full stack trace of any exception that occurs: org.hibernate.MappingException: An association from the table restriction refers to an unmapped class: TargetReportingdata
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1252)
at org.hibernate.cfg.JDBCMetaDataConfiguration.secondPassCompileForeignKeys(JDBCMetaDataConfiguration.java:33)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1170)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate$2.execute(CodeGenerationLaunchDelegate.java:322)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:88)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.buildConfiguration(CodeGenerationLaunchDelegate.java:288)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.runExporters(CodeGenerationLaunchDelegate.java:219)
at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:134)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:899)
at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Name and version of the database you are using: PostgreSQL 8.2 and Mysql 5.0

Thanks in advance for a reply,
Hspoupas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 22, 2008 10:11 am 
Newbie

Joined: Mon Jan 21, 2008 11:05 am
Posts: 5
Just to clarify some questions some people ask me when they first read my problem.

I have the DB created, i then create the cfg in eclipse and the console configuration as annotations and i have all the tables there.
When i try to reverse engineer to generate the DAO, Domain Code and cfg, i get the exception i referred.

I would be very grateful if someone can identify and solve the problem here.



I have found my problem and know what i need to do, sorry for the trouble.
You can delete this post.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 5:44 am 
Newbie

Joined: Wed Jan 23, 2008 9:57 am
Posts: 13
Please do share ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 5:58 am 
Newbie

Joined: Mon Jan 21, 2008 11:05 am
Posts: 5
Alright. The problem was that the table Target_ReportingData, that was the result of the exception, wasn't being mapped since it was an associative table(the result of the normalization of a N-M relation), hence the exception.

The ER will be modified due to to other reasons so now i know i can't try to relate those tables that way.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 7:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
but if you used reverse engineering this should not throw an exception...did you write some hbm.xml files your self or ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 8:17 am 
Newbie

Joined: Mon Jan 21, 2008 11:05 am
Posts: 5
no, didn't write anything, just followed the instructions i mentioned in my second post.
My Hibernate Code Generation has the Detect many-to-many tables option selected of course, otherwise there wouldn't be much interest in the code generated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 25, 2008 9:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
open an issue in jira with the minmal schema that makes this fail and i'll look into it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 28, 2008 9:09 am 
Newbie

Joined: Fri Aug 08, 2008 4:37 am
Posts: 5
Is this still an issue? And what is the issue tracking number??


Top
 Profile  
 
 Post subject: Re: Reverse Engineering Unmaped Class Exception
PostPosted: Tue May 28, 2013 4:10 pm 
Newbie

Joined: Fri May 24, 2013 3:45 pm
Posts: 3
I know this is an old thread, but I am having the same issue with PostgreSQL 9.2 and hibernatetools 4.0.0.RC1.

Any hints?

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Reverse Engineering Unmaped Class Exception
PostPosted: Thu Sep 19, 2013 8:22 am 
Newbie

Joined: Thu Sep 19, 2013 8:18 am
Posts: 1
{{{{{{ This post is so great and nice }}}}}}}}

I know this is an old thread, but I am having the same issue with PostgreSQL 9.2 and hibernatetools 4.0.0.RC1.

_________________
ladies leather jackets [url=http://www.ileatherjackets.co.uk]ladies leather jackets[/url]
640-461 [url=http://www.certkiller.com/exam-640-461.htm]640-461[/url]
200-101 [url=http://www.certkiller.com/exam-200-101.htm]200-101[/url]
70-640 [url=http://www.certkiller.com/exam-70-640.htm]70-640[/url]
220-801 [url=http://www.certkiller.com/exam-220-801.htm]220-801[/url]
220-802 [url=http://www.certkiller.com/exam-220-802.htm]220-802[/url]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 10 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.