1

I'm using the spring data JPA repository to call the stored procedure. As if throughout the application we have a tight dependency on the stored procedure I have to go with non-entity store procedure call. Below is the way I choose to call it:

@Query(value = "EXEC getAllOperation ?,?,?", nativeQuery = true)
Object[][] getAllOperation (@Param("user_details") int userId);

It works well in all where stored procedure returns single resultset.

But it does not work with stored procedure returning multiple resultsets. It returns the first resultset only and not giving any error.

We have spring-boot-starter-data-jpa version 1.5.8 and hibernate-jpa version 2.1 in our project.

I have gone through several threads for this solution. But could not find any solution if I want to achieve this using the current approach only.

Please help me with this.

Ronak
  • 33
  • 1
  • 6
  • You procedure return refcursor or Multiple Out param, can you show your procedure body or Signature. – Imranmadbar Jun 03 '20 at 05:42
  • @Imranmadbar Yes it returns multiple out parameters. For first resultset it returns four column whichI'm able to get. For second resultset it returns one column. But I'm not getting second resultset. – Ronak Jun 03 '20 at 06:44

1 Answers1

0

In general Spring Data JPA supports multiple out parameters of stored procedures by returning them in a Map (see https://jira.spring.io/browse/DATAJPA-707).

I doubt though that this works with some parameters being ResultSets.

As an alternative you can always create a custom method and implement it directly on the EntityManager or a JdbcTemplate.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348