From b1266cca7138bd62364958459ba8b5a654afe61f Mon Sep 17 00:00:00 2001 From: James Agnew Date: Fri, 7 Oct 2016 17:52:06 -0400 Subject: [PATCH] JPA server shouldn't report a totalCount in Bundle of "-1" when there are no results --- .../ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java | 2 +- src/changes/changes.xml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java index 39edc05d224..e669b5bcded 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java @@ -253,7 +253,7 @@ public final class PersistedJpaBundleProvider implements IBundleProvider { @Override public int size() { ensureSearchEntityLoaded(); - return mySearchEntity.getTotalCount(); + return Math.max(0, mySearchEntity.getTotalCount()); } public static Pageable toPage(final int theFromIndex, int theToIndex) { diff --git a/src/changes/changes.xml b/src/changes/changes.xml index d4bac5b617f..6831281bec3 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -176,6 +176,10 @@ Fluent client can now return types other than Parameters when invoking operations. + + JPA server shouldn't report a totalCount in Bundle of "-1" when + there are no results +