Subject Re: [Firebird-Java] using Hibernate stream with Jaybird 3.0.5 I receive error
Author Mark Rotteveel
On 2018-09-19 10:21, Gabor Dolla agdolla@... [Firebird-Java]
wrote:
> Hi
>
> I use:
> java 1.8
>
> spring boot 2.0.5 with hibernate 5.2.17
> jaybird 3.0.5
> firebird server: WI-V2.5.7.27050 Firebird 2.5
>
> I have defaultResultSetHoldable=true in the connect string
>
> a simple stream query causes this error:
>
> java.sql.SQLException: The result set is closed
> at
> org.firebirdsql.jdbc.AbstractResultSet.checkOpen(AbstractResultSet.java:287)
> ~[jaybird-jdk18-3.0.5.jar:3.0.5-JDK_1.8 (build: tag=v3.0.5
> date=201809071640)]
> at
> org.firebirdsql.jdbc.AbstractResultSet.checkCursorMove(AbstractResultSet.java:275)
> ~[jaybird-jdk18-3.0.5.jar:3.0.5-JDK_1.8 (build: tag=v3.0.5
> date=201809071640)]
> at
> org...firebirdsql.jdbc.AbstractResultSet.next(AbstractResultSet.java:350)
> ~[jaybird-jdk18-3.0.5.jar:3.0.5-JDK_1.8 (build: tag=v3.0.5
> date=201809071640)]
> at
> com.zaxxer.hikari.pool.HikariProxyResultSet.next(HikariProxyResultSet.java)
> ~[HikariCP-2.7.9.jar:na]
> at
> org.hibernate.internal.ScrollableResultsImpl.next(ScrollableResultsImpl..java:99)
> ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
> at
> org.hibernate.query.internal.ScrollableResultsIterator.hasNext(ScrollableResultsIterator.java:33)
> ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
> at java.util.Iterator.forEachRemaining(Iterator..java:115)
> ~[na:1.8.0_181]
> at
> java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
> ~[na:1.8.0_181]
> at
> java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> ~[na:1.8.0_181]
> at
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> ~[na:1.8.0_181]
> at
> java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> ~[na:1.8.0_181]
> at
> java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> ~[na:1.8..0_181]
> at java.util.stream.LongPipeline.reduce(LongPipeline.java:438)
> ~[na:1.8.0_181]
> at java.util.stream..LongPipeline.sum(LongPipeline.java:396)
> ~[na:1.8.0_181]
> at
> java.util.stream.ReferencePipeline.count(ReferencePipeline.java:526)
> ~[na:1.8.0_181]
>
> java code which causes this error:
> Stream<X> mystream = session.createQuery("from X", X.class).stream();
> long count = mystream.count();
>
> mystream.close();
>
> I do not want to use the stream for counting :) I just want to show
> the problem, any other collect causes this problem.

I will see if I can reproduce this to see what is going on.

Mark