I am using springBoot, I want to map OneToMany relationship from parent to child. Directly using entity with eager fetching I get recursive records, therefore, trying using ModelMapper for DTO mapping to Entity but I am not able to figure out how to do it. Please assume getters and setters.
Parent.java
@Entity
public class Parent {
    @Id
    private int parentId;
    private String a;
    @OneToMany(mappedBy = "parent")
    private Set<Child> child;
Child.java
@Entity
public class Child {
    @Id
    private int childId;
    private String c;
    @ManyToOne
    @JoinColumn(name = "b")
    private Parent parent;
I have working repository and servicelayer with findAll method. 
ParentDto.java
public class ParentDto {
    private String a;
    private Set<Child> child;
ParentController.java
@RestController
public class ParentController {
    @Autowired
    private ModelMapper modelMapper;
    @Autowired
    private ParentService parentService;
    @RequestMapping(method = RequestMethod.GET, value="/parents" )
    public List<ParentDto> getParents() {
        List<Parent> parents =  parentService.getAll();
        return parents.stream()
                .map(x-> modelMapper.map(x, ParentDto.class))
                .collect(Collectors.toList());
    }
}
Error: While trying to fetch http://localhost:8080/parents
.
.
ModelMapper mapping errors: 1) Converter org.modelmapper.internal.converter.CollectionConverter@51381583 failed to convert java.util.Set to java.util.Set. 1 error
org.modelmapper.MappingException: ModelMapper mapping errors:
1) Converter org.modelmapper.internal.converter.CollectionConverter@51381583 failed to convert java.util.Set to java.util.Set.
1 error
    at org.modelmapper.internal.Errors.throwMappingExceptionIfErrorsExist(Errors.java:380)
    at org.modelmapper.internal.MappingEngineImpl.map(MappingEngineImpl.java:80)
.
.
 
     
     
     
     
    