I\'m trying to map a Java DTO object to an existing JPA entity object without having to do something like the following:
public MyEntity mapToMyEntity(SomeDT
Currently ModelMapper
supports mapping also to an existing object.
It is possible to do the following (for a pseudo Spring example):
MyEntity mye = repository.finById(id);
ModelMapper mm = new ModelMapper();
mm.map(myDTO, mye);
repository.save(mye):
I am using version 2.3.1 but earlier versions might support this functionality also