I need to copy the property Friends (which is an ArrayList) from a Mono<PersonEntity> to a Mono<UserEntity> (which has not Friends property in the database), but I don't find the correct way to do it, so when i map the Mono<UserEntity> to Dto, the field Friends result to be an empty array [].
public Mono<Dto> findEntityByIdAndLabel(Long id, String label) {
return getPersonByIdAndLabel(id, label).flatMap(person -> {
return UserRepository.findByID(id);
})
.switchIfEmpty(Mono.error(new EntityNotFoundException(entity.toString(), id.toString(), label)))
.map(this::mapper);
}
I think I should add something after findById(id) but everything i tried until now didn't work.
Thanks for your time