public EmergencyAttendanceForEventHistoryVo getEmergencyAttendance(CareContextRefVo careContextRef) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get EmergencyAttendanceForEventHistoryVo on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); StringBuffer hql = new StringBuffer(); hql.append(" select Emergency from EmergencyAttendance as Emergency left join Emergency.careContext as contextID where contextID.id = :contextID"); markers.add("contextID"); values.add(careContextRef.getID_CareContext()); EmergencyAttendanceForEventHistoryVoCollection emergencyAttendance = EmergencyAttendanceForEventHistoryVoAssembler.createEmergencyAttendanceForEventHistoryVoCollectionFromEmergencyAttendance(factory.find(hql.toString(), markers, values)); if (emergencyAttendance != null && emergencyAttendance.size() > 0) { return emergencyAttendance.get(0); } else { return null; } }