gnl

          java 學習
          隨筆 - 17, 文章 - 0, 評論 - 2, 引用 - 0
          數據加載中……

          mybatis 學習記錄

          在mybatis 中無法插入記錄

          顯示信息如下:

          SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version
          0    DEBUG [main]  org.apache.ibatis.logging.LogFactory     - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
          31   DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - PooledDataSource forcefully closed/removed all connections.
          31   DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - PooledDataSource forcefully closed/removed all connections.
          31   DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - PooledDataSource forcefully closed/removed all connections.
          31   DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - PooledDataSource forcefully closed/removed all connections.
          140  DEBUG [main] org.apache.ibatis.transaction.jdbc.JdbcTransaction     - Opening JDBC Connection
          483  DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - Created connection 6259058.
          483  DEBUG [main] com.te.mybatis.persitence.ifance.PersonDao.insertperson     - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@5f8172]
          483  DEBUG [main] com.te.mybatis.persitence.ifance.PersonDao.insertperson     - ==>  Preparing: insert into person(username) values('tomcat23')
          530  DEBUG [main] com.te.mybatis.persitence.ifance.PersonDao.insertperson     - ==> Parameters:
          530  DEBUG [main] org.apache.ibatis.transaction.jdbc.JdbcTransaction     - Rolling back JDBC Connection [com.mysql.jdbc.JDBC4Connection@5f8172]
          561  DEBUG [main] org.apache.ibatis.transaction.jdbc.JdbcTransaction     - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@5f8172]
          561  DEBUG [main] org.apache.ibatis.transaction.jdbc.JdbcTransaction     - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@5f8172]
          561  DEBUG [main] org.apache.ibatis.datasource.pooled.PooledDataSource     - Returned connection 6259058 to pool.

          運行插入語句始終不能成功,但是一直沒有注意這個語句
          530  DEBUG [main] org.apache.ibatis.transaction.jdbc.JdbcTransaction     - Rolling back JDBC Connection [com.mysql.jdbc.JDBC4Connection@5f8172]
          想一想在insert里面也沒有用到事務啊,不知道是什么原因?

          在執行語句出添加事務提交 就可以插入成功 ,

                  SqlSession sqlsesstion = sc.openSession();

                  sqlsesstion.insert("insertperson", person);
                  sqlsesstion.commit();  //還不知道是什么原因要提交事務才可以插入數據成功,但是每一次似乎都對數據庫產生了影響
                  sqlsesstion.close();



          有一點亂 !!!





          posted on 2013-07-04 12:10 一江 閱讀(3106) 評論(1)  編輯  收藏 所屬分類: ibatis學習

          評論

          # re: mybatis 學習記錄  回復  更多評論   

          創造極致獵頭服務 www.51znt.com
          2014-09-11 09:35 | 智囊團
          主站蜘蛛池模板: 津市市| 乐清市| 囊谦县| 衡东县| 泸溪县| 延安市| 齐齐哈尔市| 常山县| 江陵县| 唐河县| 虞城县| 远安县| 南阳市| 延津县| 平湖市| 宁河县| 洛川县| 江门市| 盱眙县| 麦盖提县| 乐亭县| 隆昌县| 蓬安县| 太和县| 乃东县| 南昌县| 岳普湖县| 亚东县| 越西县| 绥化市| 武功县| 清苑县| 东至县| 团风县| 怀柔区| 文成县| 泗阳县| 青田县| 泰来县| 东丰县| 左云县|