I'm wondering if there's a possibility to fetch multiple tables to only one java class for exemple :
TABLE LABELS;
TABLE STANDARDS;
TABLE REFERENCES;
mapped to the same class
public Class Information {
private String type; // the type is the element who have to do the mapping => LABELS/STANDARDS/REFERENCES
...
}
It's not possible for me to construct one class for each type for technical reason (I known that some heritage should be cool).
Thank you
Gilles
EDIT :
I'll try to expain a bit more :)
I'm using a JMS service to get the informations. Each message have a particulary type, (in my exemples : "labels","standards" and "references").
By using those type, I want to persit the informations in the respective Tables. The structure is exactly the same for every messages, it's why I wanna use a unique POJO.
I hope it was better explain :)
EDIT 2 :
TABLE LABELS (
ID PRIMARY KEY AUTO_INCREMENT,
MESSAGE VARCHAR(255),
AUTHOR VARCHAR(255)
);
TABLE STANDARDS(
ID PRIMARY KEY AUTO_INCREMENT,
MESSAGE VARCHAR(255),
AUTHOR VARCHAR(255)
);
TABLE REFERENCES (
ID PRIMARY KEY AUTO_INCREMENT,
MESSAGE VARCHAR(255),
AUTHOR VARCHAR(255)
);
and here's some examples of JMS
headers :
type : label
body:
{message:"name of the country",author:"john doe"}
headers :
type : label
body:
{message:"nom du pays",author:"jenny doe"}
headers :
type : reference
body:
{message:"country",author:"john doe"}
and I want to put them into the Information Class and persist them into the correct Table