Package org.hibernate

Examples of org.hibernate.Session$LockRequest


            attributes.addAttribute(WFSSchema.NAMESPACE.toString(),
                attrs[1].getName(), null, "string", attrs[1].getFixed());
            attributes.addAttribute(WFSSchema.NAMESPACE.toString(),
                attrs[3].getName(), null, "string", "ALL");

            LockRequest lockRequest = (LockRequest) value;

            if ((lockRequest != null) && (lockRequest.getDuration() > 0)) {
                attributes.addAttribute(WFSSchema.NAMESPACE.toString(),
                    elems[2].getName(), null, "integer",
                    "" + lockRequest.getDuration());
            }

            output.startElement(element.getNamespace(), element.getName(),
                attributes);

            Object[] t = new Object[2];

            for (int i = 0; i < lockRequest.getTypeNames().length; i++) {
                t[0] = lockRequest.getTypeNames()[i];
                t[1] = lockRequest.getFilters()[i];
                elems[0].getType().encode(elems[0], t, output, hints);
            }

            output.endElement(element.getNamespace(), element.getName());
        }
View Full Code Here


            Object[] t = (Object[]) value;
            AttributesImpl attributes = new AttributesImpl();
            attributes.addAttribute(WFSSchema.NAMESPACE.toString(),
                attrs[1].getName(), null, "string", (String) t[0]);

            LockRequest lockRequest = (LockRequest) value;

            if ((lockRequest != null) && (lockRequest.getDuration() > 0)) {
                attributes.addAttribute(WFSSchema.NAMESPACE.toString(),
                    elems[2].getName(), null, "integer",
                    "" + lockRequest.getDuration());
            }

            output.startElement(element.getNamespace(), element.getName(),
                attributes);
            elems[0].getType().encode(elems[0], t[1], output, hints);
View Full Code Here

public class ProcessInstanceDbLog {
   
    @SuppressWarnings("unchecked")
  public static List<ProcessInstanceLog> findProcessInstances() {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery("from ProcessInstanceLog").list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

        return result;
    }

    @SuppressWarnings("unchecked")
  public static List<ProcessInstanceLog> findProcessInstances(String processId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processId = ?")
                .setString(0, processId).list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

        session.getTransaction().commit();
        return result;
    }

  public static List<ProcessInstanceLog> findActiveProcessInstances(String processId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processId = ? AND log.end is null")
                .setString(0, processId).list();
        session.getTransaction().commit();
        return result;
    }
View Full Code Here

        return result;
    }

    @SuppressWarnings("unchecked")
  public static ProcessInstanceLog findProcessInstance(long processInstanceId) {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List<ProcessInstanceLog> result = session.createQuery(
            "from ProcessInstanceLog as log where log.processInstanceId = ?")
                .setLong(0, processInstanceId).list();
        session.getTransaction().commit();
        return result == null || result.size() == 0 ? null : result.get(0);
    }
View Full Code Here

  /**
   * ���������лָ��ռ�
   * @param log
   */
  public static void unDelete(DiaryOutlineBean log){
    Session ssn = getSession();
    try{
      beginTransaction();
      log.setStatus(DiaryBean.STATUS_NORMAL);
      log.getCatalog().incArticleCount(1);
      log.getOwner().getCount().incArticleCount(1);
     
      //���в�����ռ������ߵ��ռ���������һ
      List rpls = log.getReplies();
      for(int i=0;rpls!=null && i<rpls.size();i++){
        DiaryReplyBean prb = (DiaryReplyBean)rpls.get(i);
        if(prb.getUser()!=null)
          prb.getUser().getCount().incArticleReply(1);
      }     
     
      ssn.update(log);
      commit();     
    }catch(HibernateException e){
      rollback();
      throw e;
    }
View Full Code Here

      if(user != null)
        hql.append(" OR (j.catalog.type=:cat_type AND j.catalog.id IN (SELECT p.key.catalog FROM CatalogPermBean AS p WHERE p.key.user=:user))");
      hql.append(')');
    }
   
    Session ssn = getSession();
   
    try{
      Query q = ssn.createQuery(hql.toString()).setCacheable(true);
      q.setTimestamp("beginTime", firstDate.getTime());
      q.setTimestamp("endTime", nextMonthFirstDate.getTime());
      q.setInteger("status", DiaryBean.STATUS_NORMAL);
      q.setInteger("site", site.getId());
      if(!site.isOwner(user)){
View Full Code Here

   * @param log_id
   * @throws SQLException
   * @throws IOException
   */
  public static void forceDelete(int log_id) throws Exception{
    Session ssn = getSession();
    try{
      DiaryBean log = (DiaryBean)ssn.load(DiaryBean.class, new Integer(log_id));
      beginTransaction();
      //����������ռ����Ӧ�ķ����ռ�����һ
      if(log.getStatus()==DiaryBean.STATUS_NORMAL){
        log.getCatalog().incArticleCount(-1);
      }
      //ɾ����ǩ
      TagDAO.deleteTagByRefId(log_id, TagBean.TYPE_DIARY);
     
      //ɾ������
      FCKUploadFileDAO.deleteFilesByRef(ssn, log.getSite().getId(), log_id,
          DiaryBean.TYPE_DIARY);

      //���в������Ƭ�����ߵ������������һ
      cleanupReplies(ssn, log_id);
     
      //ɾ���ռ�
      ssn.delete(log);
      commit();
    }catch(HibernateException e){
      rollback();
      throw e;
    }
View Full Code Here

   */
  public static void cleanupTrash(int site_id) throws Exception{
    List logs = findNamedAll("QUERY_TRASH_BEFORE_CLEANUP",site_id, DiaryBean.STATUS_DELETED);
    if(logs!=null && logs.size()>0){
      try{
        Session ssn = getSession();
        beginTransaction()
        for(int i=0;i<logs.size();i++){
          DiaryOutlineBean log = (DiaryOutlineBean)logs.get(i);
         
          //ɾ�����ռǵ���������
          cleanupReplies(ssn, log.getId());
          //ɾ����ǩ
          TagDAO.deleteTagByRefId(log.getId(), TagBean.TYPE_DIARY);         
          //ɾ������
          FCKUploadFileDAO.deleteFilesByRef(ssn, site_id, log.getId(), DiaryBean.TYPE_DIARY);
          //ɾ���ռ�
          ssn.delete(log);
        }
        commit();
      }catch(HibernateException e){
        rollback();
        throw e;
View Full Code Here

TOP

Related Classes of org.hibernate.Session$LockRequest

Copyright © 2018 www.massapicom. 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.