在Spring Boot应用程序中调用存储过程时出错

时间:2018-10-19 05:08:34

标签: hibernate spring-boot stored-procedures spring-data

我正在Spring Boot应用程序中调用存储过程,但是当使用IntelliJ IDEA时,它可以正常工作,但是当我创建Jar文件并执行它时,出现以下错误:

2018-10-18 22:45:41.721  WARN 8864 --- [nio-8082-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 201, SQLState: 37000
2018-10-18 22:45:41.721 ERROR 8864 --- [nio-8082-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : Procedure password_change_web expects parameter @id_usuario_int, which was not supplied.

2018-10-18 22:45:41.721  WARN 8864 --- [nio-8082-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 201, SQLState: 37000
2018-10-18 22:45:41.721 ERROR 8864 --- [nio-8082-exec-2] o.h.engine.jdbc.spi.SqlExceptionHelper   : Procedure password_change_web expects parameter @password, which was not supplied.

2018-10-18 22:45:41.746 ERROR 8864 --- [nio-8082-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: Error calling CallableStatement.getMoreResults; SQL [password_change_web]; nested exception is org.hibernate.exception.SQLGrammarException: Error calling CallableStatement.getMoreResults] with root cause

java.sql.SQLException: Procedure password_change_web expects parameter @id_usuario_int, which was not supplied.

我正在将Spring Boot 2.0.6.RELEASE与Spring Data一起使用。

存储库中的代码为:

@Procedure
void password_change_web(Integer idUsuarioIntranet, String password);

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

请注意,参数应与正确的名称匹配。就您而言

@Procedure
void password_change_web(Integer idUsuarioIntranet, String password);

应更改为:

@Procedure
void password_change_web(Integer idUsuarioInt, String password);