Cannot receive multiple output parameters from stored procedure with @NamedStoredProcedureQuery [DATAJPA-1722]
See original GitHub issueAlexanderStepchkov opened DATAJPA-1722 and commented
I’m trying to receive out parameters from simple stored procedure (using Oracle 11g and/or MSSQL 2012).
CREATE OR REPLACE PROCEDURE test_sp(x OUT INTEGER, y OUT INTEGER) AS
BEGIN
x := 17; y := 93;
END;
@Data
@Entity
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(name = "testSp", procedureName = "test_sp", parameters = {
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "x", type = Integer.class),
@StoredProcedureParameter(mode = ParameterMode.OUT, name = "y", type = Integer.class)
})
})
public class SomeEntity {
@Id
private Long id;
}
Please check attached demo project for details.
Using annotations I always receive errors:
java.lang.IllegalArgumentException: OUT/INOUT parameter not available: x
java.lang.IllegalArgumentException: OUT/INOUT parameter not available: 1
However if I use entityManager’s createStoredProcedureQuery method it works fine.
Affects: 2.2.7 (Moore SR7)
Attachments:
- demo.zip (5.83 kB)
1 votes, 2 watchers
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Spring Data JPA NamedStoredProcedureQuery Multiple Out ...
But once I add a second OUT parameter I get an exception saying it can't find the procedure in the entity. Caused by:...
Read more >How to call stored procedures in JPA - Part 2 - Thorben Janssen
Stored procedures with IN and OUT parameters. The first stored procedure performs a simple calculation. Therefore it takes 2 IN parameters and returns...
Read more >Parameters - SQL Server - Microsoft Learn
Output parameters allow the stored procedure to pass a data value or a cursor variable back to the caller. User-defined functions cannot ......
Read more >JPA - Using @NamedStoredProcedureQuery to call database ...
Check out this tutorial to know how to setup Oracle database and call stored procedures using EntityManager.createStoredProcedureQuery() .
Read more >@NamedStoredProcedureQuery
If false, the database platform must support naming procedure parameters ... (Optional) Specifies if the stored procedure returns multiple result sets.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Am on it…will create a quick in memory db setup and attach shortly.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.