HHH-17372 - Avoid endless recursion in default methods in Selectionquery referring to each other.

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-10-30 20:27:58 +01:00 committed by Christian Beikov
parent 00c7493aaf
commit a3f7637585
4 changed files with 16 additions and 2 deletions

View File

@ -1223,6 +1223,11 @@ public class ProcedureCallImpl<R>
return getResultList().stream();
}
@Override
public Stream stream() {
return getResultStream();
}
public ResultSetMapping getResultSetMapping() {
return resultSetMapping;
}

View File

@ -184,7 +184,7 @@ public interface Query<R> extends SelectionQuery<R>, MutationQuery, TypedQuery<R
*/
@Override
default Stream<R> stream() {
return getResultStream();
return list().stream();
}
/**

View File

@ -140,6 +140,10 @@ public interface SelectionQuery<R> extends CommonQueryContract {
* stream so that resources are freed as soon as possible.
*
* @return The results as a {@link Stream}
*
* @implNote: The default implementation simply returns
* <code>{@link #list()}.stream()</code>. Concrete implementations
* may provide more efficient implementations.
*/
default Stream<R> getResultStream() {
return stream();
@ -159,7 +163,7 @@ public interface SelectionQuery<R> extends CommonQueryContract {
* @since 5.2
*/
default Stream<R> stream() {
return getResultStream();
return list().stream();
}
/**

View File

@ -537,6 +537,11 @@ public abstract class AbstractSelectionQuery<R>
protected abstract ScrollableResultsImplementor<R> doScroll(ScrollMode scrollMode);
@Override
public Stream<R> getResultStream() {
return stream();
}
@SuppressWarnings( {"unchecked", "rawtypes"} )
@Override
public Stream stream() {