Java:未映射的目标属性
我在使用Mapper时遇到了问题,我正在使用mapstruct处理器来构建Maven项目。我一直收到警告:警告:(15,16)java:未映射的目标属性:“从,到”。警告:(13, 13) java: 未映射的目标属性: “clientFrom, clientTo”。我想用它做什么?类客户端运行良好并创建客户端。
@Entity
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String message;
@ManyToOne(cascade = {CascadeType.ALL})
@JoinColumn(name = "client_from")
private Client clientFrom;
@ManyToOne
@JoinColumn(name = "client_to")
private Client clientTo;
public Message(){}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Client getClientFrom() {
return clientFrom;
}
public void setClientFrom(Client clientFrom) {
this.clientFrom = clientFrom;
}
public Client getClientTo() {
return clientTo;
}
public void setClientTo(Client clientTo) {
this.clientTo = clientTo;
}
}
public class MessageDTO {
private Long id;
private String message;
private ClientDTO from;
private ClientDTO to;
public MessageDTO(){}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ClientDTO getFrom() {
return from;
}
public void setFrom(ClientDTO from) {
this.from = from;
}
public ClientDTO getTo() {
return to;
}
public void setTo(ClientDTO to) {
this.to = to;
}
}
@Mapper(componentModel = "spring", uses = {ClientMapper.class})
public interface MessageMapper {
Message toMessage(MessageDTO messageDTO);
MessageDTO toMessageDTO(Message message);
List<Message> toMessageList(List<MessageDTO> list);
List<MessageDTO> toMessageDTOList(List<Message> list);
}