I have a question about @ManyToOne mapping in the mapstruct. I have two tables
The first one:
@Entity
@Table(name = "members", schema = vsm)
public class MemberEntity{
@Column(name = "id", nullable = false)
protected Long id;
@ManyToOne(optional = false)
@JoinColumn(name = "case_id", nullable = false)
private CaseEntity case;
}
And the second one:
@Entity
@Table(name = "cases", schema = vsm)
public class CaseEntity {
@Column(name = "id", nullable = false)
protected Long id;
@Column(name = "description", nullable = false)
protected String description;
}
And I have a cases dto like this:
public class CasesDto{
protected Long id;
protected String description;
private List<MemberDto> members;
}
And MemberDto the same as entity.
I need to make a mapping with mapstruct like this:
CasesDto mapToDto(CaseEntity entity);
And I need to fill List members; But I can't understand how.