考虑这种情况:
public class Car() {
private Long id;
private String name;
private Car car;
}
public class CarDTO() {
private Long id;
private String name;
private Long carId;
}
我试图用这个从 DTO 映射到实体:
@Mapping(target = "car", source = "carId")
Car toEntity(CarDTO carDTO);
但它不起作用。那么,如何将实体与实体类型相同的字段映射呢?
谢谢,安德里亚