-1
I’m trying to do an UPDATE and I’m not getting it, someone can identify a point of failure ?
@Query(value="UPDATE cliente SET nome = #{#cliente.nome} WHERE id_cliente = 1", nativeQuery=true)
Cliente updateName(@Param("cliente") Cliente cliente);
The Error Displayed in the Console Is This:
2020-01-24 23:25:17.966 ERROR 14368 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [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] with root cause
org.postgresql.util.PSQLException: ERROR: syntax error at or near "{"
Posição: 28
#cliente.nome
? I never saw that syntax, it wouldn’t be:cliente.nome
? in addition, you are using the querycliente.nome
, but this assigning the parameter as@Param("cliente")
, I don’t think it’s gonna work...– Ricardo Pontual
@Ricardopunctual this is the syntax used by Spring Expression Language (Spel)
– nullptr
humm interesting @nullptr never used so, thanks for sharing
– Ricardo Pontual