Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Inheritance and hibernate mapping issue

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
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic