Я использую Spring data Jpa и хочу сопоставить одну таблицу с именем Client с моим классом с именем ClientList и получаю сообщение об ошибке, сообщающее, что клиент не сопоставлен [SELECT c FROM client c] в именованном запросе. Ниже приведен код
вот мой класс сущности и получаю сообщение об ошибке
HHH000177: ошибка в именованном запросе: getAllClients
org.hibernate.hql.internal.ast.QuerySyntaxException: клиент не сопоставлен [ВЫБРАТЬ c ОТ клиента c]
package com.abc.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery( name="getAllClients" , query="SELECT c FROM client c")
})
@Entity
@Table(name="client")
public class ClientList {
@Id
@Column(name="ClientName")
String clientName;
@Column(name="ClientId")
String clientId;
@Column(name="ImplementationCode")
String implementationCode;
@Column(name="createddate")
String cretedDate;
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getImplementationCode() {
return implementationCode;
}
public void setImplementationCode(String implementationCode) {
this.implementationCode = implementationCode;
}
public String getCretedDate() {
return cretedDate;
}
public void setCretedDate(String cretedDate) {
this.cretedDate = cretedDate;
}
@Override
public String toString() {
return "ClientDetails [clientName=" + clientName + ", clientId=" + clientId + ", implementationCode="
+ implementationCode + ", cretedDate=" + cretedDate + "]";
}
public ClientList(String clientName, String clientId, String implementationCode, String cretedDate) {
super();
this.clientName = clientName;
this.clientId = clientId;
this.implementationCode = implementationCode;
this.cretedDate = cretedDate;
}
@Id
@Column(name="ClientName")
String clientName;
@Column(name="ClientId")
String clientId;
@Column(name="ImplementationCode")
String implementationCode;
@Column(name="createddate")
String cretedDate;
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getImplementationCode() {
return implementationCode;
}
public void setImplementationCode(String implementationCode) {
this.implementationCode = implementationCode;
}
public String getCretedDate() {
return cretedDate;
}
public void setCretedDate(String cretedDate) {
this.cretedDate = cretedDate;
}
@Override
public String toString() {
return "ClientDetails [clientName=" + clientName + ", clientId=" + clientId + ", implementationCode="
+ implementationCode + ", cretedDate=" + cretedDate + "]";
}
public ClientList(String clientName, String clientId, String implementationCode, String cretedDate) {
super();
this.clientName = clientName;
this.clientId = clientId;
this.implementationCode = implementationCode;
this.cretedDate = cretedDate;
}
@Id
@Column(name="ClientName")
String clientName;
@Column(name="ClientId")
String clientId;
@Column(name="ImplementationCode")
String implementationCode;
@Column(name="createddate")
String cretedDate;
public String getClientName() {
return clientName;
}
public void setClientName(String clientName) {
this.clientName = clientName;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getImplementationCode() {
return implementationCode;
}
public void setImplementationCode(String implementationCode) {
this.implementationCode = implementationCode;
}
public String getCretedDate() {
return cretedDate;
}
public void setCretedDate(String cretedDate) {
this.cretedDate = cretedDate;
}
@Override
public String toString() {
return "ClientDetails [clientName=" + clientName + ", clientId=" + clientId + ", implementationCode="
+ implementationCode + ", cretedDate=" + cretedDate + "]";
}
public ClientList(String clientName, String clientId, String implementationCode, String cretedDate) {
super();
this.clientName = clientName;
this.clientId = clientId;
this.implementationCode = implementationCode;
this.cretedDate = cretedDate;
}
}