Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Multiple Resultset using JPA

I am using JPA(Eclipselink) to execute SQL Server Stored Procedure which returns multiple Resultsets.

As per my knowledge, easiest way to call a SP is:

entityManager.createNativeQuery("exec sp_name").getResultList();

After executing the SP I can only read the single (or very first) ResultSet.

Can some one please suggest how do I retrieve the next ResultSets (or ResultLists())?

like image 832
JSS Avatar asked Oct 26 '25 02:10

JSS


1 Answers

I can't answer for EclipseLink specifically, and I'm not sure what the JPA spec says, but most features of JPA took their cue from Hibernate, and Hibernate's limitations on stored procedures are:

The procedure must return a result set. Note that since these servers can return multiple result sets and update counts, Hibernate will iterate the results and take the first result that is a result set as its return value. Everything else will be discarded.

My guess is that JPA defines the same limitation.

like image 88
skaffman Avatar answered Oct 28 '25 14:10

skaffman