tx.commit();
List kpiDocsList = kpi.getSbiKpiDocuments();
Iterator i = kpiDocsList.iterator();
while (i.hasNext()) {
KpiDocuments doc = (KpiDocuments) i.next();
String label = doc.getBiObjLabel();
IBIObjectDAO biobjDAO = DAOFactory.getBIObjectDAO();
BIObject biobj = biobjDAO.loadBIObjectByLabel(label);
if(biobj!=null){
insertBIObject(biobj, session, true);
doc.setBiObjId(biobj.getId());
}
Integer origDocId = doc.getBiObjId();
Criterion labelCriterrion = Expression.eq("label",label);
Criteria criteria = session.createCriteria(SbiObjects.class);
criteria.add(labelCriterrion);
SbiObjects hibObject = (SbiObjects) criteria.uniqueResult();
if(hibObject!=null){
SbiKpiDocument temp = new SbiKpiDocument();
temp.setSbiKpi(hibKpi);
temp.setSbiObjects(hibObject);
KpiDocuments docK = kpiDao.loadKpiDocByKpiIdAndDocId(kpiId, origDocId);
if(docK!=null && docK.getKpiDocId()!=null){
temp.setIdKpiDoc(docK.getKpiDocId());
Transaction tx2 = session.beginTransaction();
session.save(temp);
tx2.commit();
}
}