Package org.hibernate

Examples of org.hibernate.Session.save()


      beginTransaction();
      if(journal.getStatus()==DiaryBean.STATUS_NORMAL){
        journal.getCatalog().incArticleCount(1);
        journal.getOwner().getCount().incArticleCount(1);
      }
      ssn.save(journal)
      if(journal.getCatalog().getType()==CatalogBean.TYPE_GENERAL){
        //ֻ�й��������е��ռDzſ������ñ�ǩ
        List tags = journal.getKeywords();
        if(tags!=null && tags.size()>0){
          int tag_count = 0;
View Full Code Here


            TagBean tag = new TagBean();
            tag.setSite(journal.getSite());
            tag.setRefId(journal.getId());
            tag.setRefType(DiaryBean.TYPE_DIARY);
            tag.setName(tag_name);
            ssn.save(tag);
            tag_count ++;
          }
        }
      }
      if(add_bookmark){
View Full Code Here

        bmb.setCreateTime(new Date());
        bmb.setParentId(journal.getId());
        bmb.setParentType(_BeanBase.TYPE_DIARY);
        bmb.setTitle(journal.getTitle());
        journal.getOwner().getCount().incBookmarkCount(1);
        ssn.save(bmb);
      }
      commit();
    }catch(HibernateException e){
      rollback();
      throw e;
View Full Code Here

      if(reply.getDiary().getReplyCount()>=max_reply_count && max_reply_count > 0)
        reply.getDiary().setLock(1);
      reply.getDiary().setLastReplyTime(new Date());
      if(reply.getUser()!=null)
        reply.getUser().getCount().incArticleReply(1);
      ssn.save(reply);
      commit();
    }catch(HibernateException e){
      rollback();
      throw e;
    }
View Full Code Here

      Session ssn = getSession();
      beginTransaction();
      for(int i=0;i<users.size();i++){
        UserBean user = (UserBean)users.get(i);
        msg.setToUser(user);
        ssn.save(msg);
        if(i % 20 == 0){
          ssn.flush();
          ssn.clear();
        }
      }
View Full Code Here

  public static void replyAndDeleteMessage(int old_msg_id, MessageBean msg){
    try{
      Session ssn = getSession();
      beginTransaction();
      //�ظ�����Ϣ
      ssn.save(msg);
      //ɾ�����ظ��Ķ���Ϣ
      if(old_msg_id > 0)
        executeNamedUpdate("DELETE_MESSAGE", old_msg_id, msg.getFromUser().getId());
      commit();
    }catch(HibernateException e){
View Full Code Here

        cb.setEid(rpl.getDiary().getId());
        cb.setEtype(DiaryReplyBean.TYPE_DIARY);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(StringUtils.abbreviate(rpl.getContent(), 20));
        ssn.save(cb);
        System.out.println("DiaryReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
View Full Code Here

        cb.setEid(rpl.getPhoto().getId());
        cb.setEtype(DiaryReplyBean.TYPE_PHOTO);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(StringUtils.abbreviate(rpl.getContent(), 20));
        ssn.save(cb);
        System.out.println("PhotoReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
View Full Code Here

        cb.setEid(rpl.getTopic().getId());
        cb.setEtype(DiaryReplyBean.TYPE_BBS);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(rpl.getTitle());
        ssn.save(cb);
        System.out.println("TopicReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
View Full Code Here

      order_value = friend.getSortOrder();
    }
    obj.setSortOrder(order_value - (up ? 1 : 0));
    try {
      beginTransaction();
      ssn.save(obj);
      // ���¶�ȡ�����б�����˳���������
      Query q = ssn.getNamedQuery("LIST_FORUMS");
      q.setInteger(0, obj.getSite().getId());
      List links = q.list();
      if (links.size() >= ConfigDAO.getMaxCatalogCount(obj.getSite()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.