zoukankan      html  css  js  c++  java
  • 笔记1

    public void execute(String hql) {
      baseDao.execute(hql);
     }

    public void execute(String statement) {   execute(statement, new HashMap());  }

       

    public void execute(final String statement, final Map paraMap) {

      getHibernateTemplate().execute(new HibernateCallback() {  

      public Object doInHibernate(Session session) throws HibernateException, SQLException {    

     Query query = session.createQuery(statement);     if (paraMap != null) {     

     query.setProperties(paraMap);   

      }   

      query.executeUpdate();    

     return null;    

    }

      });

     }

    public List query(final String queryString, final Map paraMap, final Integer firstResult, final Integer maxResults) {

      return getHibernateTemplate().executeFind(new HibernateCallback() {    

    public Object doInHibernate(Session session) throws HibernateException, SQLException {    

     Query query = session.createQuery(queryString);    

     if (paraMap != null) {      

    query.setProperties(paraMap);     }    

     if (firstResult != null) {      

    query.setFirstResult(firstResult);     }   

      if (maxResults != null) {      

    query.setMaxResults(maxResults);     }    

     return query.list();    }

      });  }

  • 相关阅读:
    rsyslog+loganalyzer配置
    Python字符串格式化
    awk
    haproxy配置
    CentOS7服务管理
    Nginx缓存
    父指针 子指针
    矩阵 特征向量
    指针的运算
    const 与指针 的用法
  • 原文地址:https://www.cnblogs.com/yaowen/p/2972583.html
Copyright © 2011-2022 走看看