I use Dozer to map my DTOs to JPA objects.
One use case is that the DOT representation of an existing object goes to WS, then I find the object using JPA and use Dozer to map the DTO on the found object using the map (source, destination) display method (not the map (source, destinationClass)).
I have some value objects (with the classic semantics of immutable value objects) on my objects (such as Address) like @Embeddables. The fact is that I want dozer to always create an instance of the new address when it was installed, for example: Employee object, and not display an existing instance of the address.
So, with the following classes:
public class Employee { private Address address; public void setAddress(Address address) { this.address = address; } public Address getAddress() { return this.address; } }
I want the dozer to call setAddress () always with a new instance of the address, and not by matching the fields of the new address with getAddress ().
Is there any way to do this?
source share