[hibernate-dev] New stored procedure support

Steve Ebersole steve at hibernate.org
Thu Aug 1 13:16:28 EDT 2013


Overall I am pretty confident you are not using the latest as we 
discussed on IRC.  But some comments inline...


On Thu 01 Aug 2013 10:30:04 AM CDT, Christian Bauer wrote:
- show quoted text -

Yes I think this is still a bug.  I'll fix this.  Its because of the 
concept of Returns.  I should look closer at the type of the Return


> 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().

Like I said, I don't think you are using the latest...


> 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.

Like I said, I don't think you are using the latest...


> 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.

Like I said, I don't think you are using the latest...



> 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.

Like I said, I don't think you are using the latest...


> 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.

Like I said, I don't think you are using the latest.  Here specifically, 
look for the new getCurrentReturn() method.  So you'd have:
ProcedureCall call = ...;
int updateCount = ( (UpdateCountReturn) 
call.getResults().getCurrentReturn() ).getUpdateCount();

We talked already about renaming getResults() to getOutputs() or 
getProcedureOutputs()...


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

Yes I have not implemented this yet.  Need to get a database set up that 
actually supports this (oracle or postgres are the only 2 I know). If 
you want to help, this would be a good place to help since you seem to 
have a working pgsql setup already.  I can help in terms of how I think 
it *should* work...


More information about the hibernate-dev mailing list