} else {
nextProg = new Integer(maxProg.intValue() + 1);
}
// store the object template
SbiObjTemplates hibObjTemplate = new SbiObjTemplates();
//check if id is already defined. In positive case update template else insert a new one
if (objTemplate.getId() != null && objTemplate.getId().compareTo(new Integer("-1")) != 0){
hibObjTemplate = (SbiObjTemplates)aSession.load(SbiObjTemplates.class, objTemplate.getId());
hibObjTemplate.setActive(new Boolean(true));
} else {
hibObjTemplate.setActive(new Boolean(true));
hibObjTemplate.setCreationDate(new Date());
hibObjTemplate.setName(objTemplate.getName());
hibObjTemplate.setProg(nextProg);
hibObjTemplate.setSbiBinContents(hibBinContent);
SbiObjects obj = (SbiObjects) aSession.load(SbiObjects.class, objTemplate.getBiobjId());
hibObjTemplate.setSbiObject(obj);
// metadata
String user = objTemplate.getCreationUser();
if (user == null || user.equals(""))user = obj.getCreationUser();
hibObjTemplate.setCreationUser(user);
hibObjTemplate.setDimension(objTemplate.getDimension());
updateSbiCommonInfo4Insert(hibObjTemplate);
aSession.save(hibObjTemplate);
}
tx.commit();
} catch(HibernateException he) {