diff --git a/api/src/main/java/org/openmrs/module/cohort/api/impl/CohortMemberServiceImpl.java b/api/src/main/java/org/openmrs/module/cohort/api/impl/CohortMemberServiceImpl.java index ad604d1..2f04e75 100644 --- a/api/src/main/java/org/openmrs/module/cohort/api/impl/CohortMemberServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/cohort/api/impl/CohortMemberServiceImpl.java @@ -154,8 +154,11 @@ public Collection findCohortMembersByCohortUuid(String cohortUuid) @Override @Transactional(readOnly = true) public Collection findCohortMembersByPatientUuid(String patientUuid) { - return cohortMemberDao.findBy( - PropValue.builder().property("uuid").associationPath(Optional.of("patient")).value(patientUuid).build()); + Criteria criteria = cohortMemberDao.createCriteria(); + criteria.createAlias("patient", "patient"); + criteria.add(Restrictions.eq("patient.uuid", patientUuid)); + criteria.add(Restrictions.isNull("endDate")); + return criteria.list(); } @Override