question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot receive multiple output parameters from stored procedure with @NamedStoredProcedureQuery [DATAJPA-1722]

See original GitHub issue

AlexanderStepchkov 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.

Link to SO https://stackoverflow.com/questions/61655464/spring-boot-data-jpa-receive-multiple-out-parameters-from-sql-servers-stored-pr


Affects: 2.2.7 (Moore SR7)

Attachments:

1 votes, 2 watchers

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
satscreatecommented, Mar 8, 2021

Am on it…will create a quick in memory db setup and attach shortly.

0reactions
spring-projects-issuescommented, Mar 23, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found