Hello,
I am calling a stored procedure that should return multiple rows but only one row is returned. Each row is converted to an entity:
Code:
EntityManager.Query.createNativeQuery("{ CALL my_procedure() }", MyEntity.class).getResultList()
After debugging, I can see that the "rs.next()" in org.hibernate.loader.Loader.doQuery return true in the first iteration and false in the next iteration.
As far as I know, for stored procedures (at least with MySQL) the "has more rows" check should be done on the statement:
Code:
statement.execute(); // If true, there is at least one row and keep iterating while (statement.getMoreResults())
I confirmed that using the debugger and evaluating "rs.getStatement().getMoreResults()" which returns true while "rs.next()" is false.
I know JPA does not officially support stored procedures but how can I workaround this issue?
hibernate 4.1.3
hibernate-jpa-2.0-api-1.0.1.Final