So I have a bunch of classes that I'm mapping to a table. From those classes, I have another one to upload those records (this is all I need in this particular case). Those classes are all different but the interface that extends JpaRepository are always the same except of course for the object (MY_CLASS_A, MY_CLASS_B etc). Is there any way for me to create only one Repository class so all those entity classes can create the repository based on the class?
My idea is to have multiple classes but only one repository class.
Thank you!
@Entity
@Table(name = "my_table_A")
public class MY_CLASS_A {
}
...
public interface MY_CLASS_A_DAO extends JpaRepository<MY_CLASS_A, Long> {
}
public interface MY_CLASS_B_DAO extends JpaRepository<MY_CLASS_B, Long> {
}
...
MY_CLASS_A_DAO repositoryA = ...;
repositoryA.saveAll(...);
MY_CLASS_B_DAO repositoryA = ...;
repositoryB.saveAll(...);