2
So Guys I’m having a problem when performing a query through a @query, well basically what I need is a list of a status column in the bd that returns only students who are with the status "Finished" for this I wrote the following query @Query("select p.status from Aluno p where p.status = 'Concluido' ")
at first I had no problem, but when I went to view Hibernate released this exception.
Failed to convert from type [java.util.ArrayList] to type [@org.springframework.data.jpa.repository.Query java.util.List] for value '[Concluido]'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.string] to type [@org.springframework.data.jpa.Repository.Query com.academy.model.Student] org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.util.ArrayList] to type [@org.springframework.data.jpa.repository.Query java.util.List] for value '[Concluido]'; nested Exception is org.springframework.core.convert.Converternotfoundexception: No converter found capable of Converting from type [java.lang.String] to type [@org.springframework.data.jpa.Repository.Query com.academy.model.Student]
Class:
@Entity
public class Student{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String nome;
private String curso;
private String idade;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date dataCadastro;
@Column(name = "Turno")
private String horario;
private String status;
private String tel;
@Column(name = "telefone_alternativo")
private String telAlt;
// Getters and Setters
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
public String getIdade() {
return idade;
}
public void setIdade(String idade) {
this.idade = idade;
}
public Date getDataCadastro() {
return dataCadastro;
}
public void setDataCadastro(Date dataCadastro) {
this.dataCadastro = dataCadastro;
}
public String getHorario() {
return horario;
}
public void setHorario(String horario) {
this.horario = horario;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getTelAlt() {
return telAlt;
}
public void setTelAlt(String telAlt) {
this.telAlt = telAlt;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}