spring boot jap中一对多关系在多方集合中丢失内容的问题,我的字段结构
@Data
@DynamicUpdate
@DynamicInsert
@Entity(name = "st")
public class St {
@Id
private Long id;
private Long stn;
@OneToMany(mappedBy = "sts")
private Set<Mt> mts;
}
@Data
@DynamicUpdate
@DynamicInsert
@Entity(name = "mt")
public class Mt {
@Id
private Long id;
private Long stn;
@ManyToOne
private St sts;
}
@Override
public Market details(Long id) {
Optional<St> byId = mtr.findById(1L);
System.out.println();
// Market market = marketRep.findById(id).orElseThrow(() -> WebException.entityNotFoundException(id));
return null;
}
很奇怪使用set集合多方字段列表就没有数据,换成list就可以,头很痛xdm