[hibernate-dev] Statements leaks when using JPA StoredProcedureQuery API

Robert Marcano robert at marcanoonline.com
Mon Oct 16 10:28:03 EDT 2017


On 10/16/2017 10:13 AM, Steve Ebersole wrote:
> On Mon, Oct 16, 2017 at 9:00 AM Robert Marcano <robert at marcanoonline.com 
> <mailto:robert at marcanoonline.com>> wrote:
> 
>     No, I know implicitly closing the JDBC statement is not possible with
>     only the current CallableStatement API. There is no way to know if the
>     client code needs or read all possible outputs from the stored
>     procedure. My previous email mentioned making CallableStatement an
>     AutoCloseable but that will make the API too different from the other
>     kind of queries, that you explained better than me, are stateless.
> 
>     Maybe exposing Hibernate ProcedureOutputs to JPA or StoredProcedureQuery
>     implementing some kind of prepareCall() method that return a stateful
>     object that implement AutoCloseable.
> 
> 
> "Exposing Hibernate ProcedureOutputs to JPA" how?  Something beyond the
> `storedProcedureQuery.unwrap( ProcedureOutputs.class )` I mentioned earlier?
> 

Yes, I think there should be a way to close a StoredProcedureQuery 
internal statement without the need to unwrap to a JPA implementation class.

An equivalent to ProcedureOutputs added to the JPA spec implementing 
AutoCloseable sounds fine to me.


More information about the hibernate-dev mailing list