Пример #1
0
 public void deleteById(Integer consumableId) {
   log.debug("deleting Consumable instance with id: " + consumableId);
   try {
     hibernateTemplate.bulkUpdate(
         "delete Consumable where consumableId=?", new Object[] {consumableId});
   } catch (RuntimeException re) {
     log.error("get failed", re);
     throw re;
   }
 }
Пример #2
0
 @Override
 @Transactional(readOnly = false, rollbackFor = Exception.class)
 public void delete(String levelForUserId) throws UserExistInLevelException {
   // 如果有用户处于当前等级,则不能删除
   String hql = "select count(user) from User user where user.level.id = ?";
   long n = (Long) ht.find(hql, levelForUserId).get(0);
   if (n > 0) {
     throw new UserExistInLevelException();
   }
   ht.bulkUpdate("delete from LevelForUser lfu where lfu.id = ?", levelForUserId);
 }
Пример #3
0
 // 出入库更新
 public void updateQuantity(Integer quantity, Integer consumableId) throws Exception {
   // TODO Auto-generated method stub
   try {
     hibernateTemplate.bulkUpdate(
         "update Consumable set quantity=? where consumableId=?",
         new Object[] {quantity, consumableId});
     hibernateTemplate.flush();
   } catch (RuntimeException re) {
     // TODO: handle exception
     throw re;
   } finally {
     hibernateTemplate.clear();
   }
 }
Пример #4
0
 /** 更新对象 */
 public int bulkUpdate(String queryString) {
   return hibernateTemplate.bulkUpdate(queryString);
 }