> However, stored procedures also have the ability to return multiple types of objects in separate ResultSet of data.
This use case is not covered by the specification. The only cases covered are getResultList() and getSingleResult() that expect the query to return a ResultSet, and executeUpdate(), that expects an int returned from the query.
So, getResultList() and getSingleResult() are mapped to a Statement.executeQuery(), and executeUpdate() is mapped to executeUpdate().
> When trying to get a ResultList(), I use
> Query query = em.createNativeQuery(sql);
> List<Applicant> appList = query.getResultList();
> and get:
> Statement.executeQuery() cannot be called with a statement that returns a row count. Odd message since a row count is not being returned, but multiple ResultSets
Considering that the error description for Statement.executeQuery() says "if a database access error occurs; this method is called on a closed PreparedStatement or the SQL statement does not return a ResultSet object", the error message might better read "Statement.executeQuery() cannot be called with a statement that does not return a ResultSet object".
But in any case, I don't see how to handle a native query that returns multiple result sets without changing the specification to deal with it.