-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com
Description
Hi,
I used @procedure annotation to call a stored procedure in a MS SQL-Server and it create one argument too many.
I tried with @query and it's ok.
Here is the stored procedure declaration
DELIMITER $$
CREATE PROCEDURE `import.SP_CreateImport`(IN `categoryCode` VARCHAR(10), IN `typeCode` VARCHAR(10), IN `name` VARCHAR(10), OUT `result` INT)
Select 1$$
DELIMITER ;
With @procedure
@Procedure(procedureName = "import.SP_CreateImport")
Integer createImport(String categoryCode, String typeCode, String name);
result in
bdo-connector-1 | 2024-10-18T14:11:58.212Z DEBUG 1 --- [bdo-timsheet-extractor] [ main] org.hibernate.SQL :
bdo-connector-1 | {call import.SP_CreateImport(?, ?, ?, ?)}
bdo-connector-1 | Hibernate:
bdo-connector-1 | {call import.SP_CreateImport(?, ?, ?, ?)}
bdo-connector-1 | 2024-10-18T14:11:58.265Z WARN 1 --- [bdo-timsheet-extractor] [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 8144, SQLState: S0002
bdo-connector-1 | 2024-10-18T14:11:58.266Z ERROR 1 --- [bdo-timsheet-extractor] [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Procedure or function SP_CreateImport has too many arguments specified.
With @query
@Query(value = "{CALL import.SP_CreateImport(:categoryCode, :typeCode, :name)}", nativeQuery = true)
Integer createImport(@Param("categoryCode") String categoryCode, @Param("typeCode") String typeCode, @Param("name") String name);
result in
bdo-connector-1 | 2024-10-18T14:27:43.417Z DEBUG 1 --- [bdo-timsheet-extractor] [ main] org.hibernate.SQL :
bdo-connector-1 | {CALL import.SP_CreateImport(?, ?, ?)}
bdo-connector-1 | Hibernate:
bdo-connector-1 | {CALL import.SP_CreateImport(?, ?, ?)}
bdo-connector-1 | 2024-10-18T14:27:43.488Z WARN 1 --- [bdo-timsheet-extractor] [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 50001, SQLState: S0001
bdo-connector-1 | 2024-10-18T14:27:43.489Z ERROR 1 --- [bdo-timsheet-extractor] [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Impossible to find import category [IMPORT -> CATEGORY -> XXX]
I still have work to do but the last issue lies in my SQL stored procedure, not in Java.
Metadata
Metadata
Assignees
Labels
for: stackoverflowA question that's better suited to stackoverflow.comA question that's better suited to stackoverflow.com