Suppose a Person aggregate and DTO :
public class Person extends BaseAggregateRoot<UUID> {
@Identity(handler = UUIDHandler.class)
private UUID id;
private String name;
}
public class PersonDTO {
private UUID id;
private String name;
}
In a standard workflow, we would create a PersonDTO without id in a interface and send it to the server. The server would then merge it into a freshly created aggregate :
fluentAssembler.merge(personDTO).into(Person.class).fromFactory();
The default factory will create a UUID as identity with the IdentityService, but when the actual mapping will happen, the null value of the DTO's id will override the generated id of the aggregate.
One workaround is to call the identity service again after the merge.
Suppose a Person aggregate and DTO :
In a standard workflow, we would create a PersonDTO without
idin a interface and send it to the server. The server would then merge it into a freshly created aggregate :The default factory will create a UUID as identity with the IdentityService, but when the actual mapping will happen, the
nullvalue of the DTO'sidwill override the generatedidof the aggregate.One workaround is to call the identity service again after the merge.