I have 5 tables in MySQL (words_1, words_2... words_5) with the same fields (id,words,sinonim). In the field "words" I put different count of words (for words_1 = 1 word, for words_5 = 5 words). I create 5 classes and Repo for those. Constructors and methods are the same.
import javax.persistence.*;
@Entity
@Table(name = "words_2")
public class Words2 {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String word;
private String sinonim;
public Words2() {
}
public Words2(String word, String sinonim) {
this.word = word;
this.sinonim = sinonim;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public String getSinonim() {
return sinonim;
}
public void setSinonim(String sinonim) {
this.sinonim = sinonim;
}
}
How I can take my classes fields and methods, using variable(int = 1..5) with Reflection, for Class and same Repo identification?
Aucun commentaire:
Enregistrer un commentaire