Из-за этого я столкнулся с ошибкой< /p>
Невозможно найти атрибут с заданным именем [messageSequenceID] в этом ManagedType [com.loader.batch.IF.entity.UserFlight]
Вот мой код:
В классе сущности UserFlight это выглядит так
Код: Выделить всё
package com.loader.batch.IF.entity;
import jakarta.persistence.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@Entity
@Table(name = "data_flight")
public class UserFlight {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "MessageSequenceID", nullable = false)
private Long MessageSequenceID;
@Column(name = "MessageType", length = 30)
private String MessageType;
@Column(name = "ServiceType", length = 30)
private String ServiceType;
@Column(name = "OperationMode", length = 30)
private String OperationMode;
@Column(name = "SendDateTime", length = 30)
private String SendDateTime;
@Column(name = "CreateDateTime", length = 30)
private String CreateDateTime;
public UserFlight(
Long MessageSequenceID,
String MessageType,
String ServiceType,
String OperationMode, String SendDateTime, String CreateDateTime) {
this.MessageSequenceID = MessageSequenceID;
this.MessageType = MessageType;
this.ServiceType = ServiceType;
this.OperationMode = OperationMode;
this.SendDateTime = SendDateTime;
this.CreateDateTime = CreateDateTime;
}
public Long getMessageSequenceID() {
return MessageSequenceID;
}
public void setMessageSequenceID(Long messageSequenceID) {
MessageSequenceID = messageSequenceID;
}
public String getMessageType() {
return MessageType;
}
public void setMessageType(String messageType) {
MessageType = messageType;
}
public String getServiceType() {
return ServiceType;
}
public void setServiceType(String serviceType) {
ServiceType = serviceType;
}
public String getOperationMode() {
return OperationMode;
}
public void setOperationMode(String operationMode) {
OperationMode = operationMode;
}
public String getSendDateTime() {
return SendDateTime;
}
public void setSendDateTime(String sendDateTime) {
SendDateTime = sendDateTime;
}
public String getCreateDateTime() {
return CreateDateTime;
}
public void setCreateDateTime(String createDateTime) {
CreateDateTime = createDateTime;
}
}
Код: Выделить всё
Pageable pageable = PageRequest.of(req.getPage(), req.getLimit(), Sort.by("MessageSequenceID"));
UserFlight userFlight = new UserFlight();
userFlight.setStatus(req.getSearch());
Example example = Example.of(userFlight, SEARCH_CONDITIONS_MATCH_ANY);
var flightData = flightRepository.findAll(example, pageable);
Код: Выделить всё
org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate Attribute with the given name [messageSequenceID] on this ManagedType [com.loader.batch.IF.entity.UserFlight]
Это не работает. Он по-прежнему использует messageSequenceID, а не MessageSequenceID.
Подробнее здесь: https://stackoverflow.com/questions/766 ... type-xxx-a