Fix #1174 - Prevent serialization exception
This commit is contained in:
parent
5d540d9208
commit
5f29e4fbf3
|
@ -255,7 +255,15 @@ public class DateParam extends BaseParamWithPrefix<DateParam> implements /*IQuer
|
|||
return b.build();
|
||||
}
|
||||
|
||||
public class DateParamDateTimeHolder extends BaseDateTimeDt {
|
||||
public static class DateParamDateTimeHolder extends BaseDateTimeDt {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public DateParamDateTimeHolder() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
|
||||
return TemporalPrecisionEnum.SECOND;
|
||||
|
|
|
@ -2,9 +2,9 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
|
||||
import ca.uhn.fhir.jpa.config.CaptureQueriesListener;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.util.TestUtil;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
|
@ -14,9 +14,9 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
|||
import ca.uhn.fhir.rest.param.*;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.engine.jdbc.internal.BasicFormatterImpl;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
@ -56,6 +56,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
|
||||
myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum());
|
||||
myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches());
|
||||
myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -1143,6 +1144,40 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #1174
|
||||
*/
|
||||
@Test
|
||||
public void testSearchDateInSavedSearch() {
|
||||
for (int i = 1; i <= 9; i++) {
|
||||
Patient p1 = new Patient();
|
||||
p1.getBirthDateElement().setValueAsString("1980-01-0" + i);
|
||||
String id1 = myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue();
|
||||
}
|
||||
|
||||
myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(3, 6, 10));
|
||||
|
||||
{
|
||||
// Don't load synchronous
|
||||
SearchParameterMap map = new SearchParameterMap();
|
||||
map.setLastUpdated(new DateRangeParam().setUpperBound(new DateParam(ParamPrefixEnum.LESSTHAN, "2022-01-01")));
|
||||
IBundleProvider found = myPatientDao.search(map);
|
||||
Set<String> dates = new HashSet<>();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
Patient nextResource = (Patient) found.getResources(i, i + 1).get(0);
|
||||
dates.add(nextResource.getBirthDateElement().getValueAsString());
|
||||
}
|
||||
|
||||
assertThat(dates, hasItems(
|
||||
"1980-01-01",
|
||||
"1980-01-09"
|
||||
));
|
||||
|
||||
assertFalse(map.isLoadSynchronous());
|
||||
assertNull(map.getLoadSynchronousUpTo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* #222
|
||||
*/
|
||||
|
|
|
@ -339,6 +339,11 @@
|
|||
of unneccesary joins were introduced to the generated SQL query, harming
|
||||
performance. This has been fixed.
|
||||
</action>
|
||||
<action type="fix">
|
||||
A serialization error when performing some searches in the JPA server
|
||||
using data parameters has been fixed. Thanks to GitHub user
|
||||
@PickOneFish for reporting!
|
||||
</action>
|
||||
</release>
|
||||
<release version="3.6.0" date="2018-11-12" description="Food">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue