Get all updates of Java4s
Follow Us: Email Newsletter

Inheritance Mapping In Hibernate – Introduction

Hibernate » On Jun 20, 2011 { 21 Comments } By Sivateja

Compared to JDBC we have one main advantage in hibernate, which is hibernate inheritance.  Suppose if we have base and derived classes, now if we save derived(sub) class object, base class object will also be stored into the database.
But the thing is we must specify in what table we need to save which object data ( i will explain about this point later, just remember as of now).

For Example:

  • See if you save CreditCard class object, then payment class object will also be saved into the database

Hibernate supports 3 types of Inheritance Mappings:

  • Table per class hierarchy
  • Table per sub-class hierarchy
  • Table per concrete class hierarchy

Note: We can also called this Hibernate Inheritance Mapping as Hibernate Hierarchy

Will see these 3 Inheritance Mappings in depth___, friends ensure you are clear about all previous concepts so far we covered, if not so you may not understand further, please refer once if you have any doubts.

You Might Also Like

  ♦ About Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


21 Responses to “Inheritance Mapping In Hibernate – Introduction”
  1. rajkirpal says:

    Hi, Java4s

    You have explained the tuffest topics in very very essiest way.
    really i never find this kind of explanation on any website or in any book ever before.

    Thank you so much.

  2. Java4s says:


    Thanks much friend :-)

  3. ram says:

    Way of explanation its very good thank you

  4. Gahininath says:

    I really enjoyed..thanx alot to is very useful and simple site..

  5. priyabrat says:

    Thanks Sivateja for the nice post.
    Could you please post the mapping example using annotation.

  6. sritej says:

    Thanks..Very clean explanation.. Could you please tell me, which one is better to use out of three..

  7. satti says:

    Thanks siva. could you please tell me, which is the better to use in that?

  8. Amar says:

    Good…site .Any one can understand easily.

  9. Naveen says:

    bhai, bahut hi badiya likhte ho.

    Keep it up Bro.

  10. Shashi says:

    Thanks a lot Shiva……………..:). it is explained very easyest way and understandable.

  11. Nandu says:

    Whenever I go to understand any tough topic in java. I search the topic as Topic Name appended with java4s

  12. biram says:

    good site

  13. arch says:

    very good site to learn…keep posting :)

  14. Swamy says:

    I have learned hibernate from core to concepts….This site is very help full

  15. swetha says:

    Thank you so much SivaTeja for this tutorial:)

  16. sagar s rao says:


    Awesome job helped a lot

  17. Basu says:

    Nice Explanation…

  18. RAMA says:

    when i was read this tutorial,
    it is all about the class room explanation by Shekar sir from Satya institute,Ameerpet,Hyderabad.

    Thank you guys for the presentation of line to line from note book by shekar sir….

  19. haris says:

    I must say, ur articles have really brushed up my topics dat any site or book couldn’t do….amazing!


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.