as in title i got some problems with query in JPQL
that's the query I'm using:
@Query(value = "SELECT DISTINCT o.idWhom FROM Message o WHERE o.idWho = ?1 ORDER BY o.date DESC")
List<Users> allCorrespondents(Users user);
Class message:
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@NotBlank
private String content;
@Temporal(TemporalType.TIMESTAMP)
private Date date = new Date();
boolean read = false;
@ManyToOne
@JoinColumn(name = "id_who")
private Users idWho;
@ManyToOne
@JoinColumn(name = "id_whom")
private Users idWhom;
}
Error I've got:
2022-06-17 13:02:22.435 ERROR 2304 --- [nio-8080-exec-2] c.e.h.S.CustomAuthorizationFilter :
Error logging in: Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet