Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink + Stream + Java 8(Having trouble reading out data from streams)
EclipseLink + Stream + Java 8 [message #1741577] Fri, 26 August 2016 02:10 Go to next message
Siddu R. is currently offline Siddu R.Friend
Messages: 1
Registered: August 2016
Junior Member
Hi,

I am trying to execute a stored procedure on Sql Server using Java 8. The result is fetched as stream but whenever I try to iterate or do anything with result(stream), I get the following exception:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Invalid state, the ResultSet object is closed.
Error Code: 0
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331)
	at org.eclipse.persistence.queries.ScrollableCursor.getPosition(ScrollableCursor.java:253)
	at org.eclipse.persistence.queries.ScrollableCursor.retrieveNextObject(ScrollableCursor.java:551)
	at org.eclipse.persistence.queries.ScrollableCursor.loadNext(ScrollableCursor.java:411)
	at org.eclipse.persistence.queries.ScrollableCursor.hasNext(ScrollableCursor.java:277)
	at org.springframework.data.jpa.provider.PersistenceProvider$EclipseLinkScrollableResultsIterator.hasNext(PersistenceProvider.java:501)
	at java.util.Iterator.forEachRemaining(Iterator.java:115)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.sql.SQLException: Invalid state, the ResultSet object is closed.
	at net.sourceforge.jtds.jdbc.JtdsResultSet.checkOpen(JtdsResultSet.java:302)
	at net.sourceforge.jtds.jdbc.JtdsResultSet.getRow(JtdsResultSet.java:450)
	at com.zaxxer.hikari.pool.HikariProxyResultSet.getRow(HikariProxyResultSet.java)
	at org.eclipse.persistence.queries.ScrollableCursor.getPosition(ScrollableCursor.java:239)
	... 21 more

Re: EclipseLink + Stream + Java 8 [message #1742233 is a reply to message #1741577] Thu, 01 September 2016 03:21 Go to previous message
Clovis Wichoski is currently offline Clovis WichoskiFriend
Messages: 11
Registered: January 2016
Junior Member
This appears to be more how you deal and maintain this scenario, how you maintain the original conection you used to get the result and do process with stream? Its long transaction, its short? Maybe a database timeout? Tell us more about your case.
Previous Topic:Saving to array not working
Next Topic:EclipseLink / MySQL / Connector/J / UTF-8 Issue
Goto Forum:
  


Current Time: Fri Dec 15 10:32:21 GMT 2017

Powered by FUDForum. Page generated in 0.02768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software