public PatientCustomListVo getPatientCustomList(CustomListRefVo voCustListRefVo) { DomainFactory factory = getDomainFactory(); String hql = " from PatientCustomList pcl "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); condStr.append(" where pcl.customList.id = :cl"); markers.add("cl"); values.add(voCustListRefVo.getID_CustomList()); if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); PatientCustomListVoCollection voColl = PatientCustomListVoAssembler.createPatientCustomListVoCollectionFromPatientCustomList(factory.find(hql, markers, values)); if (voColl.size() > 0) return voColl.get(0); return null; }