public AreaOfNeedCollection getAreaOfNeeds(ClinicalContactShortVo voClinicalContact) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); String query = "from SoapNote sn where"; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if(voClinicalContact != null) { hql.append(" sn.clinicalContact.id = :cc"); markers.add("cc"); values.add(voClinicalContact.getID_ClinicalContact()); andStr = " and "; } hql.append(andStr + " sn.areaofNeed.size > 0"); query += hql.toString(); List AreaList = factory.find(query, markers, values); //if(AreaList.size() == 1) // return SoapNoteShortVoAssembler.createSoapNoteShortVoCollectionFromSoapNote(AreaList).get(0).getAreaofNeed(); SoapNoteShortVoCollection tempVoCol = SoapNoteShortVoAssembler.createSoapNoteShortVoCollectionFromSoapNote(AreaList); if(tempVoCol.size() == 1) return tempVoCol.get(0).getAreaofNeed(); return null; }