public AdmissionDetailLiteVo getMothersAdmission(PatientRefVo patient) { if (patient == null || patient.getID_Patient() == null) throw new CodingRuntimeException( "patient is null or id not provided in method getMothersAdmission"); // get the patient to read ClientParent value Patient doPatient = (Patient) getDomainFactory().getDomainObject(patient); if (doPatient != null && doPatient.getClientParent() != null) { List admissions = getDomainFactory() .find( "from AdmissionDetail adm left join fetch adm.pasEvent as pe left join fetch pe.patient as pat where pat.id = " + doPatient.getClientParent().getId()); if (admissions != null && admissions.size() > 0) return AdmissionDetailLiteVoAssembler.create((AdmissionDetail) admissions.get(0)); } return null; }