Using JPA with stored procedures that return multiple result sets

laloumen picture laloumen · Jul 8, 2014 · Viewed 9.6k times · Source

Is it possible to handle multiple result sets having different columns from a stored procedure in SQL Server using JPA? What is a way (or the best way) to do this?

I am currently working with Hibernate 4.3.5 Final and JPA 2.1, SqlServer 2008.

The saga of my current approach can be found here: Hibernate JPA, inheritance and Stored Procedure returning multiple result sets

but it apparently not the right approach. If anyone knows how to make this work, please let me know. Thanks!!

Answer

Neil Stockton picture Neil Stockton · Jul 9, 2014

Using the docs for the JPA implementation that I use, you can see the JPA standard way of retrieving multiple result sets on this page. Page down to "Generalised execution, for multiple result sets"

http://www.datanucleus.org/products/accessplatform_4_0/jpa/stored_procedures.html