try{daoManager.startTransaction();  
这里是批量更新,或者插入daoManager.commitTransaction();
} finally { 
 daoManager.endTransaction();  
} 这样写会提高程序的执行效率吗?如果不能提高,应该怎么写,请大家帮忙看一下,谢谢

解决方案 »

  1.   

     try {
                sqlMap.startTransaction();
                sqlMap.startBatch();
                for (Iterator it = listDmBz.iterator(); it.hasNext();)
                    sqlMap.update("updateXT_MODULEByXybz", it.next());            sqlMap.executeBatch();
                sqlMap.commitTransaction();
            } catch (SQLException e) {
                String err = "成批更新系统模块选用标志时->出错原因:" + e.getMessage();
                log.error(err, e);
                throw new DaoException(err, e);
            } finally {
                try {
                    sqlMap.endTransaction();
                } catch (SQLException e) {
                    log.error(e.getMessage());
                }
            }