我收到此错误
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "("
Position: 26
尝试使用以下方法时
存储库
@Query(value = "select new AgendamentoDTO(a.id, a.data, s.nome, p.nome, pro.nome) " + "from agendamento a " + "join pacientes p on p.id = a.paciente_id " + "join profissionais pro on pro.id = a.profissional_id " + "join servico s on s.id = a.servico_id", nativeQuery = true)
List<AgendamentoDTO> agendamentos3();
DTO
@Data
@NoArgsConstructor
public class AgendamentoDTO {
private Integer id;
private String data;
private String servico;
private String paciente;
private String profissional;
public AgendamentoDTO(Integer id, String paciente, String data, String profissional, String servico) {
this.id = id;
this.data = data;
this.servico = servico;
this.paciente = paciente;
this.profissional = profissional;
}
}
Spring数据- 2.7.0
数据库- PostgreSQL
1条答案
按热度按时间mkshixfv1#
当我更改为JPQL时有效。