Merge branch 'master' of github.com:jamesagnew/hapi-fhir

This commit is contained in:
James 2017-06-16 10:35:57 -04:00
commit 76e3428d33
1 changed files with 10 additions and 12 deletions

View File

@ -43,16 +43,7 @@ import org.hl7.fhir.instance.model.api.*;
import com.google.common.collect.*; import com.google.common.collect.*;
import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.*;
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeChildChoiceDefinition;
import ca.uhn.fhir.context.RuntimeChildResourceDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao; import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamUriDao; import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamUriDao;
import ca.uhn.fhir.jpa.entity.*; import ca.uhn.fhir.jpa.entity.*;
@ -1253,7 +1244,7 @@ public class SearchBuilder implements ISearchBuilder {
return new QueryIterator(); return new QueryIterator();
} }
private TypedQuery<Long> createQuery(SortSpec sort) { private TypedQuery<Long> createQuery(SortSpec sort, Integer theMaximumResults) {
CriteriaQuery<Long> outerQuery; CriteriaQuery<Long> outerQuery;
/* /*
* Sort * Sort
@ -1366,6 +1357,11 @@ public class SearchBuilder implements ISearchBuilder {
* Now perform the search * Now perform the search
*/ */
final TypedQuery<Long> query = myEntityManager.createQuery(outerQuery); final TypedQuery<Long> query = myEntityManager.createQuery(outerQuery);
if (theMaximumResults != null) {
query.setMaxResults(theMaximumResults);
}
return query; return query;
} }
@ -2031,7 +2027,9 @@ public class SearchBuilder implements ISearchBuilder {
// If we don't have a query yet, create one // If we don't have a query yet, create one
if (myResultsIterator == null) { if (myResultsIterator == null) {
final TypedQuery<Long> query = createQuery(mySort); Integer maximumResults = myCallingDao.getConfig().getFetchSizeDefaultMaximum();
final TypedQuery<Long> query = createQuery(mySort, maximumResults);
myResultsIterator = query.getResultList().iterator(); myResultsIterator = query.getResultList().iterator();
// If the query resulted in extra results being requested // If the query resulted in extra results being requested