• Post Reply Bookmark Topic Watch Topic
  • New Topic

Inheritance and hibernate mapping issue  RSS feed

zabet tyan
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I have an abstract class called AbstractActivity that doesn't map to any tables. I have two concrete classes AActivity and BActivity that map to two separate tables.

Here is the mapping of AActivity

I have a very similar mapping for BActivity. I want to keep these two entities separate in db.

Now here is the code for AActivity:

and here is the code for AbstractActivity

Now when i create an object from AActivity or BActivity and save it, there is no problem, everything is saved in db.

but I get an exception if i try to call any queries in AActivity's or BActivity's mapping file. Here is the exception:

Does "java.lang.InstantiationException: org.hibernate.impl.QueryImpl " mean that hibernate cannot understand the way my code is structured and hence cannot instantiate it?

I also tried

but no luck.

Any ideas?

thanks in advance
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!