• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Inheritance Strategy and Why

T H Lim
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have 3 non-abstract persist-able classes. MyClubUser and HisClubUser classes inherit from User class. I use one table per subclass strategy i.e. @Inheritance(strategy = InheritanceType.JOINED), for these classes. What I have observed was the generated SQL uses left outer join HisClubUser and MyClubUser when I do a query on User class. Why Hibernate does that [joining other tables] where my concern is only User table? My point is even though the data is retrieved, I would not able to access these properties in MyClubUser or HisClubUser given that User instances are returned. Also, does this causes additional overhead as compared to a query where it just query User table without the left outer join?



What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!