Hi. I have the following entity called Profile:
@Entity
//Getter and setter annotations from Lombok
@Getter
@Setter
@ToString
@RequiredArgsConstructor
public class Candidate {
@Id
@GeneratedValue
@JsonIgnore
long ID;
@Embedded
@ElementCollection(fetch = FetchType.EAGER)
List< @Valid WorkExperience> workHistory;
@ElementCollection(fetch = FetchType.EAGER)
Map<TransportMode, Integer> maxTravelTimes;`
// ... hasCode, and equals methods
}
When I fetch the profile, I get duplicated entries for workHistory. So if workHistory cantains 2 elements I would get 4,6 or 8 depending on how many entries are stored maxTravelTimes. So if maxTravelTimes has 4 entries, I would get 4 duplicated entries in workHistory.
What am I doing wrong? I don’t know how to fix it other than manually remove the duplicates from the list after fetching