I have class structure like below
class Animal{
int animalId;
Dogs dogs;
//setters and getters
}
class Dogs{
List<Dog> dogs;
getDogsList(){
...
}
setDogsList(){
...
}
}
class Dog{
int animalId;
String name;
}
Now I have to map oneToMany between Animal and List entity which is in different class Dogs. I know this is a bad design but I have to deal with it. Ideally it should have been
class Animal{
int animalId;
List<Dog> dogs;
//setters and getters
}
but all these pojos comes from an xml file which I can not modify. is there any way for me to map oneToMany between Animal and Dog (ignoring class Dogs)?
you can probably do it like this: