on-internet
← Community

How to map oneToMany using ModelMapper

Stack Overflow ·

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 reposito

Comments

Sign in or sign up to comment and upvote.

No comments yet.