Hibernate Inheritance Strategy and Why

后端 未结 3 1843
感情败类
感情败类 2020-12-18 13:53

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(strateg

3条回答
  •  隐瞒了意图╮
    2020-12-18 14:29

    You query on User, so Hibernate will execute a 'polymorphic query'. Since MyClubUser and HisClubUser are User objects by nature (they inherit from User), Hibernate will retrieve these kind of users as well.

提交回复
热议问题