use of org.hibernate.query.internal.ScrollableResultsIterator in project hibernate-orm by hibernate.
the class AbstractSelectionQuery method stream.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Stream stream() {
final ScrollableResultsImplementor scrollableResults = scroll(ScrollMode.FORWARD_ONLY);
final ScrollableResultsIterator iterator = new ScrollableResultsIterator<>(scrollableResults);
final Spliterator spliterator = Spliterators.spliteratorUnknownSize(iterator, Spliterator.NONNULL);
final Stream stream = StreamSupport.stream(spliterator, false);
return (Stream) stream.onClose(scrollableResults::close);
}
Aggregations