Some of the issues I've found with JPA 2.1 and the overall new stored procedure 
APIs:

1. StoredProcedureQuery#hasMoreResults() returns true if the next result is an 
update count, it should return false, according to API documentation. On MySQL, 
if a SP returns a single or multiple ResultSets, you also get an update count 
of 0. Internally it simply returns row_count() for the last SQL statement in 
the procedure if you invoke CallableStatement#getUpdateCount().

2. If there is only one ResultSet returned by the SP, I should be able to call 
StoredProcedureQuery#getResultList() without first calling hasMoreResults(). 
This maps to JDBC CallableStatement#excuteQuery().

3. When I try to read an OUT argument at index 2 with 
StoredProcedureQuery#getOutputParameterValue(), it only works if I get it with 
index 1. This seems like a simple offset bug.

4. Calling an SP which only returns an update count, I should be able to use 
only StoredProcedureQuery#executeUpdate(). This works in plain JDBC, currently 
I get an IllegalStateException because I haven't called hasMoreReturns() before.

5. Calling an SP which only returns an update count, the 
StoredProcedureQuery#execute() method should return false, it currently returns 
true, even if there is no ResultSet.

6. Calling an SP which only returns an update count is awkward with the 
Hibernate StoredProcedureCall API, involving several lines and casts to get the 
update count.

7. Note sure how to call/handle REF_CURSOR parameters in either API, doesn't 
seem to be implemented.


_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to