X
X
xxxxc2019-08-19 11:23:05
Java
xxxxc, 2019-08-19 11:23:05

How to make inheritance from objects which get from a DB?

Decided to replace switch with inheritance. Now in the database, in the request table, there are objects in which one field (variable) is constantly used in the switch case and on which the code execution constantly depends.
Objects are obtained from the database through Spring Data JPA and it turns out List<Requests> requests
that there is also a RequestRepository and RequestService.
I need the same list, only that it has different types of objects that are inherited from Requests.
At what stage should I convert these Request into inherited objects depending on one field?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question