• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inheritence in hibernate

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pals,

Can any one tell me what are the main benifits if we used Inheritence in Hibernate.

Please reply me. Thanks in Advance.


Regards,
Ram
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the question really comes down to OO and not Hibernate. When in Java OO would you find inheritance better than composition, or just that inheritance is the way to go with OO?


The "Inheritance in Hibernate" is just that if you have an inheritance tree in Java then it is possible to map it to tables in Hibernate.

Mark
 
Rama Krishna Gaddipati
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we acheive any more in performance wise by using Inheritence in Hiberate?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rama Krishna Gaddipati:
Can we acheive any more in performance wise by using Inheritence in Hiberate?



Again, this isn't a Hibernate issue. Inheritance is Java Inheritance. However, you have your database designed, is what will determine any performance.

So here's a quick example

I have an Account class and two subclasses BankAccount and CreditCard. So how will that affect performance? Well in no way at all.

Performance will only be dictated by your database. Meaning do you have 1 table for this, or 2 tables or 3 tables, and if so will the query to the database need to include a join or not. And even if you have 1 2 or 3 tables, you could choose to create a class heirarchy or not, it wouldn't affect the query needed to run against the database.

Does that make more sense?

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic