• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Inheritance Strategy and Why

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

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?


Thanks

/lim/

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic