Matheus Henrique
Matheus Henrique

Reputation: 1

Hibernate mapping for classes with inheritance

I need help with the architecture of my classes. I am developing a system with several different actors and I put the common attributes in a parent class and extended the others from it. So I have ADMIN, CLIENT, MANAGER all extending from USER. I could not think of a smart way to do Hibernate mapping. I need to access a table with all the users. Should it be a table for each entity?

Also, if I have a Service for each class, would it be wise to have AdminService, ClientService, etc extend from UserService? How do I do that?

I am using the following architecture: Controllers Service Domain Repository

Project is in Spring boot, Java

Upvotes: 0

Views: 380

Answers (1)

Tomasz
Tomasz

Reputation: 1040

Just like kamlesh commented, on https://thoughts-on-java.org/complete-guide-inheritance-strategies-jpa-hibernate/ you will find all standard approaches. Problem is not new and well supported by Hibernate

Upvotes: 1

Related Questions