Subject Re: [Firebird-Java] using Hibernate stream with Jaybird 3.0.5 I receive error
Author Mark Rotteveel
On 2018-09-28 08:18, Gábor Dolla gabor.dolla@... [Firebird-Java]
wrote:
> I guess I figured it out but of course I might be wrong.
>
> I have a @Repository class which is annotated as @Transactional and in
> that class I have a method which returns the Stream.
> I call this method from my @Controller, which processes the stream and
> returns data to the browser.
> It fails with the exception I sent last week. If I start the
> transaction in the controller method it works.
>
> So I guess in the first case the transaction ends when the repository
> method returns and it closes the resultset. The controller method
> tries to process
> the Stream but it's too late.
> It's not specific to firebird, this thread is also interesting:
> https://www.postgresql-archive.org/New-significance-of-holdable-result-sets-in-Java-8-td5826656.html

Thanks, I had't considered that situation when I was trying to reproduce
it, but it sounds logical. That discussion you linked is interesting,
but it looks like the OP there forgot the effects of having the
connection returned to the connection pool when the transaction ends,
which should invalidate (close) any open result sets. That is probably
the case here as well.

Mark