Hey! I am building a project, and I decided to use single table strategy as my entity inheritance, but this is the first time I had to use it. So my question is that how should I build a service for this starategy?
For simplicity, and because the content of the classes doesnt really matter, I will provide schematic example
(lombok annotations are excluded for the sake of space):
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "discriminator")
@DiscriminatorValue("Common")
public class A{}
@Entity
@DiscriminatorValue("disc1")
public class B extends A{}
@Entity
@DiscriminatorValue("disc2")
public class C extends A{}
Now I have a repository or all 3 classes separately, but I planned to create 1 service class for the entire inheritance tree. I can understand why it would make more sense to make 1 for each of them, but I am curious if I can make only a single one. Also there are scenarios when I want to query all subtypes of A including A, so then it would make sense to have everything in 1 place. At least for me.
All help is appreciated!