Parameter parameter = null;
try{
parameter = loadForDetailByParameterID(parameterID);
Role role = DAOFactory.getRoleDAO().loadByName(roleName);
aSession = getSession();
tx = aSession.beginTransaction();
Criterion domainCdCriterrion = null;
Criteria criteria = null;
// load all the paruse with the given parmaeter id
domainCdCriterrion = Expression.eq("sbiParameters.parId", parameter.getId());
criteria = aSession.createCriteria(SbiParuse.class);
criteria.add(domainCdCriterrion);
List paruses = criteria.list();
List parUseAssociated = new ArrayList();
Iterator parusesIter = paruses.iterator();
while(parusesIter.hasNext()) {
SbiParuse hibParuse = (SbiParuse)parusesIter.next();
Iterator paruseDetsIter = hibParuse.getSbiParuseDets().iterator();
while(paruseDetsIter.hasNext()){
SbiParuseDet hibParuseDet = (SbiParuseDet)paruseDetsIter.next();
if (hibParuseDet.getId().getSbiExtRoles().getExtRoleId().equals(role.getId())){
parUseAssociated.add(hibParuse);
}
}
}