Transaction tx = null;
try {
aSession = getSession();
tx = aSession.beginTransaction();
SbiGoalHierarchy hibGoalHierarchy = new SbiGoalHierarchy();
hibGoalHierarchy.setName(goalNode.getName());
hibGoalHierarchy.setLabel(goalNode.getLabel());
hibGoalHierarchy.setGoal(goalNode.getGoalDescr());
hibGoalHierarchy.setOrgUnitId(goalNode.getOuId());
hibGoalHierarchy.setGoalId(goalNode.getGoalId());
if(fatherId!=null){
Query hibQuery = aSession.createQuery(" from SbiGoalHierarchy s where s.goalHierarchyId = ? ");
hibQuery.setInteger(0, fatherId);
SbiGoalHierarchy father= (SbiGoalHierarchy)hibQuery.uniqueResult();
hibGoalHierarchy.setSbiGoalHierarchy(father);
}
updateSbiCommonInfo4Insert(hibGoalHierarchy);
aSession.save(hibGoalHierarchy);
tx.commit();