[hibernate-dev] StoredProcedureQuery holds on to the underlying CallableStatement

Vlad Mihalcea mihalcea.vlad at gmail.com
Mon May 16 09:56:24 EDT 2016


Hi,

You are right. I forgot this is a JPA interface. You mean we need to cast
it to the Impl class and get the ProcedureOutput from there:

spq.unwrap( StoredProcedureQueryImpl.class ).getProcedureOutputs().close()

Vlad

On Mon, May 16, 2016 at 4:24 PM, Steve Ebersole <steve at hibernate.org> wrote:

> I think it is reasonable to have have an ability to release the underlying
> CallableStatement.  I think its a matter of how and where to expose that
> though.  StoredProcedureQuery is a JPA contract, so we can't add it
> there.  Also StoredProcedureQueryImpl is an internal class and we
> generally discourage users from binding to that contracts.
>
> I'd actually vote we add this method to ProcedureOutputs and JPA users
> would be expected to do `spq.unwrap( ProcedureOutputs.class ).close()`
>
> On Mon, May 16, 2016 at 7:42 AM Vlad Mihalcea <mihalcea.vlad at gmail.com>
> wrote:
>
>> Hi,
>>
>> I got this very interesting feature request on our forum:
>>
>> https://forum.hibernate.org/viewtopic.php?f=1&t=1043273&p=2489575#p2489575
>>
>> Looks like the StoredProcedureQuery holds on to the CallableStatement
>> object, which only gets closed when the LogicalConnectionManagedImpl
>> object
>> is closed too (when the transaction is committed).
>>
>> I guess we could provide a close() method so that users can decide if they
>> want to close the underlying CallableStatement right after the call is
>> executed.
>>
>> What do you think? Should I add a New Feature issue on Jira?
>>
>> Vlad
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>


More information about the hibernate-dev mailing list