File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes WrongClassException in Inheritance Mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "WrongClassException in Inheritance Mapping" Watch "WrongClassException in Inheritance Mapping" New topic

WrongClassException in Inheritance Mapping

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Hi All,

I am trying to map an inheritance relationship, but i am getting an error.
This is my mapping file:

This is the method where the exception is thrown:

and the exception:

Can someone help me? i am stuck at this.

Thanks in advance for early responses

The Best way to predict your future is to create it - Every great individual common man
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

My only guess is that it is related to your use of generics.

<?> I would think you would want something line <? super Category> or is it <? extends Category> My brain isn't quite working at this very moment.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Diego Garcia

Joined: Sep 14, 2004
Posts: 16
Hello Mark,

I originally wrote that post in the hibernate forums, and that guy "Ankur Sharma" has copied it (please, Ankur Sharma, post your own questions).

this is the link to my post in the Hibernate forums:

Thanks for the help

P.S. Edited to add the link
[ June 04, 2008: Message edited by: Diego Garcia ]
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Diego Garcia, please check your private messages.
[ June 04, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jelle Klap

Joined: Mar 10, 2008
Posts: 1951

I recall nearly driving myself insane trying to figure out where this WrongClassException kept coming from. Just as I was about ready to axe-murder some bunnies, I took a final look at the hibernate.cfg.xml file and noticed that i had failed to include the particular entity's mapping file.
Which made no sense to me, because I expected an entirely different exception, but that was the reality of it nonetheless. So, double checking your mapping definitions in hibernate.cfg.xml might be worth it - please, think of the bunnies.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Diego Garcia

Joined: Sep 14, 2004
Posts: 16
Thanks for the help, Jelle, but no luck for me. I have included the entity's mapping file...any other idea? anyone?

Thanks in advance
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Ankur Sharma, please check your private messages.
I agree. Here's the link:
subject: WrongClassException in Inheritance Mapping
It's not a secret anymore!