Java學(xué)習(xí)

          java,spring,structs,hibernate,jsf,ireport,jfreechart,jasperreport,tomcat,jboss -----本博客已經(jīng)搬家了,新的地址是 http://www.javaly.cn 如果有對文章有任何疑問或者有任何不懂的地方,歡迎到www.javaly.cn (Java樂園)指出,我會盡力幫助解決。一起進(jìn)步

           

          數(shù)據(jù)庫 批量操作, 函數(shù)執(zhí)行

           1. 批量 delete 和 save

              public void deleteAllData() {
                  List l=this.getHibernateTemplate().find("from SchedulerSeq");
                  if(l!=null && l.size()>0)
                      this.getHibernateTemplate().deleteAll(l);
                 
              }

              public void saveAll(List<BusBatIn> batinList) {
                  this.getHibernateTemplate().saveOrUpdateAll(batinList);
                 
              }

           執(zhí)行函數(shù)

              public void callSaveBusStatus(Date lastTime) {
                  Connection con=this.getSession().connection();

                  PreparedStatement st = null;

                 
                 
                  try {
                      if(lastTime==null){
                          st = con.prepareStatement("select savet_vehicle_status(?) from Dual ");
                          st.setString(1,BusConstant.VEHICLE_BUS);
                      }else{
                          st = con.prepareStatement("select savet_vehicle_status(?,?) from Dual ");
                          st.setTimestamp(1,java.sql.Timestamp.valueOf(String.valueOf(lastTime)));
                          st.setString(2,BusConstant.VEHICLE_BUS);
                      }
                  
                         
                      st.execute();
                                 
                  } catch (SQLException e) {
                      e.printStackTrace();
                  } finally {

                      try{
                          if(st != null){
                              st.close();
                          }
                      } catch (Exception e) {
                          st = null;
                      }
                      try{
                          if(con != null){
                              con.close();
                          }
                      } catch (Exception e) {
                          con = null;
                      }
                  }
                 
              }
           

          posted on 2008-10-24 17:08 找個美女做老婆 閱讀(270) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計

          公告

          本blog已經(jīng)搬到新家了, 新家:www.javaly.cn
           http://www.javaly.cn

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 务川| 武义县| 靖远县| 雷波县| 水富县| 太康县| 那曲县| 巨鹿县| 崇阳县| 马关县| 马龙县| 广汉市| 秦皇岛市| 凤城市| 左权县| 北川| 图木舒克市| 乐昌市| 龙口市| 稷山县| 白朗县| 泰和县| 呼伦贝尔市| 云梦县| 天祝| 三台县| 静乐县| 商丘市| 多伦县| 廉江市| 德钦县| 明光市| 宣恩县| 萨迦县| 广宗县| 天气| 广灵县| 容城县| 清水河县| 湘西| 阿荣旗|