Session aSession = null;
Transaction tx = null;
try {
aSession = getSession();
tx = aSession.beginTransaction();
SbiDistributionListsObjects hibDistributionListsObjects = new SbiDistributionListsObjects();
//String hql = "from SbiDistributionListsObjects sdlo where sdlo.sbiDistributionList.dlId=" + dl.getId()+" and sdlo.sbiObjects.biobjId="+biobId;
String hql = "from SbiDistributionListsObjects sdlo where sdlo.sbiDistributionList.dlId=? and sdlo.sbiObjects.biobjId=?";
Query query = aSession.createQuery(hql);
query.setInteger(0, dl.getId());
query.setInteger(1, biobId);
List l = query.list();
if(!l.isEmpty()){
Iterator it = l.iterator();
while(it.hasNext()){
SbiDistributionListsObjects temp = (SbiDistributionListsObjects)it.next();
String xmlstr = temp.getXml();
SourceBean sb = SourceBean.fromXMLString(xmlstr);
String trigName = (String)sb.getAttribute("triggerName");
if (trigName != null && trigName.equals(triggername)){
hibDistributionListsObjects = temp;
aSession.delete(hibDistributionListsObjects);