diff --git a/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java b/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java index 758824d05..ef2662c8e 100644 --- a/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java +++ b/src/main/java/org/opensrp/repository/postgres/LocationRepositoryImpl.java @@ -365,6 +365,8 @@ public List findLocationsByProperties(boolean returnGeometry, LocationMetadataExample locationMetadataExample = new LocationMetadataExample(); if (parentId != null) { locationMetadataExample.createCriteria().andParentIdEqualTo(parentId); + } else { + locationMetadataExample.createCriteria().andParentIdIsNull(); } List locations = locationMetadataMapper.selectManyByProperties(locationMetadataExample, properties, returnGeometry, 0, DEFAULT_FETCH_SIZE);