Use a stream

This commit is contained in:
Michael Buckley 2024-04-04 17:37:49 -04:00
parent 928b80d602
commit bd86afac4e
1 changed files with 4 additions and 4 deletions

View File

@ -65,6 +65,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends BaseStorageDao public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends BaseStorageDao
@ -248,9 +249,8 @@ public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends B
query.setParameter("IDS", idChunk); query.setParameter("IDS", idChunk);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object[]> queryResults = query.getResultList(); Stream<Object[]> queryResultStream = query.getResultStream();
return queryResultStream
return queryResults.stream()
.map(nextPair -> { .map(nextPair -> {
// Store the matching ResourceHistoryTable in the transient slot on ResourceTable // Store the matching ResourceHistoryTable in the transient slot on ResourceTable
ResourceTable result = (ResourceTable) nextPair[0]; ResourceTable result = (ResourceTable) nextPair[0];
@ -266,7 +266,7 @@ public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends B
* Convenience wrapper around prefetchByJoinClause() for simple fields. * Convenience wrapper around prefetchByJoinClause() for simple fields.
* *
* @param theDescription for logging * @param theDescription for logging
* @param theJpaFieldName the field to join * @param theJpaFieldName the join field from ResourceTable
* @param theEntityPredicate select which ResourceTable entities need this join * @param theEntityPredicate select which ResourceTable entities need this join
* @param theEntities the ResourceTable entities to consider * @param theEntities the ResourceTable entities to consider
*/ */