I have two tables. Employee and User.
Employee is annotated with Inheritance(strategy = InheritanceType.JOINED) User is annotated with @PrimaryKeyJoinColumn(name = "super_id")
Everything is fine if i use the User entity.
When i want to load Employee instance hibernate raised "Column clazz not found" with SQL query. As a workaround i tried injecting fake column like "0 as clazz" but is raised duplicate column error. Anyway, If i use HQL query like "from Employee where id=1" it loads User instance by id=1.
Since Employee entity is not an abstract class, i hope hibernate will load it as Employee instance.
To brief my case in details; There are many employees in my customer and some of them can use system as user and some of them can not. And also i have a third table named Managers which extends Employee entity too. Same person can be an Employee, a User and a Manager with JUST ONE ID.
In java inheritance that is possible and so easy but why not in JPA? Am i using wrong inheritance strategy? Any idea will be appreciated.
Thanks.