I have problem with ScrollableCursor. On my local environment it works well but on remote env I got exception:
Internal Exception: java.sql.SQLException: The result set is closed. Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620) at org.eclipse.persistence.queries.ScrollableCursor.getPosition(ScrollableCursor.java:251) 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)
My query:
private static final String SELECT_QUERY = "SELECT"
+ " new MyObjectDto(object.id, object.time)"
+ " FROM ObjectEntity object"
+ " WHERE object.msgDateTime < :startDateTime ";
@Override
public ScrollableCursor getScrollableCursor(LocalDateTime startDateTime) {
TypedQuery<ScrollableCursor> query = createQuery(SELECT_QUERY, ScrollableCursor.class)
.setParameter("startDateTime", startDateTime)
.setHint(QueryHints.SCROLLABLE_CURSOR, HintValues.TRUE);
return query.getSingleResult();
}
Could you please give me some ideas what can be wrong?