I have Classes hierarchical like this:
Class A{
private int a;
}
Class B extend A{
private int b;
}
Class C extend A{
private int c;
}
Class Prime {
private int a;
private A objectA;
}
And I have DTOs for every single classes like this:
Class Dto_A{
private int a;
}
Class Dto_B extend Dto_A{
private int b;
}
Class Dto_C extend Dto_A{
private int c;
}
Class Dto_prime {
private int prime;
private Dto_A objectA;
private int b;
}
How can I map field b from Dto_B
in Dto_prime
class if objectA
instance of Dto_B in dozzer? (as below code:)
Dto_prime dto_p = new Dto_prime();
Dto_B dto_b = new Dto_B();
if(dto_p.objectA instance of Dto_B)
dto_p.setB(dto_b.getB());
I read inheritance mapping in dozer and add hint in XMLs but it don't work for me and throw exception.
I also try set-method and get-method in XML and do checking like below:
if (objectA instance of Dto_B)
//do something...
but when i debug it. objectA
not instance of none of Class B
or Class C
.
Note: I persist Prime object with instance of class B
as field objectA
in Prime.
Any body have suggestion?