public MedicationRouteCollection getRoutes(MedicationRefVo medication, DoseFormIndicator form) { if (!medication.getID_MedicationIsNotNull()) throw new DomainRuntimeException("Medication with null as id"); String hql = "select routes from Medication as medication left join medication.forms as forms left join forms.formRoutes as routes" + " left join forms.form as form where (medication.id = :medId and form.id = :formId)"; List<?> dos = getDomainFactory().find(hql,new String[]{"medId","formId"},new Object[]{medication.getID_Medication(),form.getID()}); if (dos == null || dos.size() == 0) return null; MedicationRouteLiteVoCollection routes = MedicationRouteLiteVoAssembler.createMedicationRouteLiteVoCollectionFromMedicationRoute(dos); MedicationRouteCollection result = new MedicationRouteCollection(); for (int i = 0 ; i < routes.size() ; i++) { if( routes.get(i)!=null && routes.get(i).getRouteIsNotNull()) result.add(routes.get(i).getRoute()); } return result; }