@Transactional(rollbackFor = Throwable.class)
  @Override
  public void saveOrUpdateRecord(ArchivedInferredLocationRecord record) {
    _template.saveOrUpdate(record);

    CcLocationReportRecord cc = findRealtimeRecord(record);
    if (cc != null) {
      CcAndInferredLocationRecord lastKnown = new CcAndInferredLocationRecord(record, cc);
      _template.saveOrUpdate(lastKnown);
    }

    _template.flush();
    _template.clear();
  }
 @Override
 @Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRES_NEW)
 public void handleException(String content, Throwable error, Date timeReceived) {
   InvalidLocationRecord ilr = new InvalidLocationRecord(content, error, timeReceived);
   _template.saveOrUpdate(ilr);
   // clear from level one cache
   _template.flush();
   _template.evict(ilr);
 }
 /* (non-Javadoc)
  * @see cn.cas.iue.dao.ConsumableDAO#updateConsumable(cn.cas.iue.bean.Consumable)
  */
 @Override
 public void updateConsumable(Consumable consumable) throws Exception {
   // TODO Auto-generated method stub
   try {
     hibernateTemplate.saveOrUpdate(consumable);
     hibernateTemplate.flush();
   } catch (RuntimeException re) {
     // TODO: handle exception
     throw re;
   } finally {
     hibernateTemplate.clear();
   }
 }
  // LockSampleModificationsInterceptor automatically obtains lock
  private final void internalCreateSample(
      final SamplePE sample,
      final HibernateTemplate hibernateTemplate,
      final ClassValidator<SamplePE> classValidator,
      final boolean doLog) {
    validatePE(sample, classValidator);
    sample.setCode(CodeConverter.tryToDatabase(sample.getCode()));

    hibernateTemplate.saveOrUpdate(sample);
    if (doLog && operationLog.isInfoEnabled()) {
      operationLog.info(String.format("ADD: sample '%s'.", sample));
    }
  }
示例#5
0
 @Override
 @Transactional(readOnly = false, rollbackFor = Exception.class)
 public void saveOrUpdate(LevelForUser levelForUser)
     throws SeqNumAlreadyExistException, MinPointLimitCannotMattchSeqNumException {
   List<LevelForUser> lfus = ht.loadAll(LevelForUser.class);
   for (Iterator iterator = lfus.iterator(); iterator.hasNext(); ) {
     LevelForUser lfu = (LevelForUser) iterator.next();
     if (lfu.getId().equals(levelForUser.getId())) {
       // 如果是修改,则需要先移除相同id的元素,然后添加修改后的
       iterator.remove();
     }
   }
   if (lfus.size() > 0) {
     lfus.add(levelForUser);
     // 根据序号升序排序
     Collections.sort(
         lfus,
         new Comparator<LevelForUser>() {
           @Override
           public int compare(LevelForUser o1, LevelForUser o2) {
             return o1.getSeqNum() - o2.getSeqNum();
           }
         });
     // 遍历,判断
     for (int i = 0; i <= lfus.size() - 2; i++) {
       LevelForUser currentLfu = lfus.get(i);
       LevelForUser nextLfu = lfus.get(i + 1);
       // 序号不能为空,且序号不能与之前已有的序号相同
       if (currentLfu.getSeqNum() == nextLfu.getSeqNum()) {
         throw new SeqNumAlreadyExistException();
       }
       // 等级积分下线,与等级序号排序是否相同
       if (currentLfu.getMinPointLimit() >= nextLfu.getMinPointLimit()) {
         throw new MinPointLimitCannotMattchSeqNumException();
       }
     }
   }
   ht.saveOrUpdate(levelForUser);
 }
示例#6
0
 @Transactional
 @Override
 public void update(LookFor lookFor) {
   template.saveOrUpdate(lookFor);
   template.flush();
 }
 @Override
 public void saveState(State record) {
   hibernateTemplate.saveOrUpdate(record);
 }
 /** Saves person. */
 @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
 public void save(Person person) {
   template.saveOrUpdate(person);
 }
 @Transactional(readOnly = false)
 public void saveStat(Stat s) {
   hibernateTemplate.saveOrUpdate(s);
 }
 @Transactional(readOnly = false)
 public void saveStatCategory(StatCategory sc) {
   hibernateTemplate.saveOrUpdate(sc);
 }
示例#11
0
 public void saveOrUpdata(Object object) {
   HibernateTemplate ht = getHibernateTemplate();
   ht.saveOrUpdate(object);
   ht.flush();
 }
 @Transactional(readOnly = false)
 public void saveTestExecution(TestExecution t) {
   hibernateTemplate.saveOrUpdate(t);
 }
示例#13
0
 @Override
 public void saveOrUpdate(E entity) {
   ht.saveOrUpdate(entity);
 }
 /**
  * 更新一条图片新闻
  *
  * @param pict
  * @return true
  */
 public boolean update(MhqxTabPicture pict) {
   if (pict == null) return false;
   hibernateTemplate.saveOrUpdate(pict);
   return true;
 }
示例#15
0
 public void save(Authorities authorities) {
   hibernateTemplate.saveOrUpdate(authorities);
 }
示例#16
0
  // 保存项目工兼职教师人员
  public void saveWageEmpPerson(UserBO user, String wage, String other) throws SysException {

    boolean isnew = user.getUserID() == null ? true : false;
    if (isnew) {
      String sql = "select personnum_sequence.nextval from dual";
      int code = this.jdbcTemplate.queryForInt(sql);
      user.setPersonSeq(code + "");
      user.setComeDate(CommonFuns.getSysDate("yyyy-MM-dd"));
    }
    PersonBO pEdit = null;
    if (!isnew) {
      pEdit = SysCacheTool.findPersonById(user.getUserID());
    }
    OrgBO org = SysCacheTool.findOrgById(user.getDeptId());
    OrgBO superOrg = SysCacheTool.findOrgById(org.getSuperId());
    user.setDeptSort(org.getTreeId());
    user.setMainDeptSort(superOrg.getTreeId());
    user.setOrgId(superOrg.getOrgId());
    if (user.isHasCash()) {
      user.setHasCashStr("1");
    } else {
      user.setHasCashStr("0");
    }
    HibernateTemplate temp = (HibernateTemplate) SysContext.getBean("hibernateTemplate");
    temp.saveOrUpdate(user);
    temp.flush();

    // 添加
    if (isnew) {
      String sql =
          "insert into sys_user_info s (s.person_id,s.login_name,login_pwd,s.is_use) values ('"
              + user.getUserID()
              + "','"
              + user.getName()
              + "','98f6bcd4621d373cade4e832627b4f6',0)";
      this.jdbcTemplate.execute(sql);
      String wageOrgId = superOrg.getOrgId();
      sql =
          "insert into a795 (id,a795701,a795705,a795708,a795710,a795718,a795720,a795725) values ('"
              + user.getUserID()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "','"
              + user.getOrgId()
              + "')";
      this.jdbcTemplate.execute(sql);
      sql =
          "insert into a239 (id,a239200,a239201) values ('"
              + user.getUserID()
              + "','"
              + wage
              + "','"
              + other
              + "')";
      this.jdbcTemplate.execute(sql);
    } else {
      String sql =
          "update a239 set a239200='"
              + wage
              + "',a239201='"
              + other
              + "' where id='"
              + user.getUserID()
              + "'";
      this.jdbcTemplate.execute(sql);
    }
  }
示例#17
0
 @Override
 public Naryad update(Naryad entity) {
     ht.getSessionFactory().getCurrentSession().clear();
     ht.saveOrUpdate(entity);
     return entity;
 }