Terry.Li-彬

          虛其心,可解天下之問;專其心,可治天下之學;靜其心,可悟天下之理;恒其心,可成天下之業。

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            143 隨筆 :: 344 文章 :: 130 評論 :: 0 Trackbacks

          I'm using Spring 3.1.1, MyBatis 3.1.1, MySQL 5.0.67. My Spring configuration is below:

          				
          						<
          						bean id
          						=
          						"dataSource"
          						 class
          						=
          						"org.apache.tomcat.jdbc.pool.DataSource"
          						 destroy-method
          						=
          						"close"
          						>
          						
          						
          						<
          						property name
          						=
          						"driverClassName"
          						 value
          						=
          						"com.mysql.jdbc.Driver"
          						
          						
          						/>
          						
          						
          						<
          						property name
          						=
          						"url"
          						 value
          						=
          						"${jdbc.url}"
          						
          						
          						/>
          						
          						
          						<
          						property name
          						=
          						"username"
          						 value
          						=
          						"${jdbc.username}"
          						
          						
          						/>
          						
          						
          						<
          						property name
          						=
          						"password"
          						 value
          						=
          						"${jdbc.password}"
          						
          						
          						/>
          						
          						
          						<
          						property name
          						=
          						"validationQuery"
          						 value
          						=
          						"select 1"
          						/>
          						
          						
          						<
          						property name
          						=
          						"testWhileIdle"
          						 value
          						=
          						"true"
          						/>
          						
          						
          						<
          						property name
          						=
          						"timeBetweenEvictionRunsMillis"
          						 value
          						=
          						"14400000"
          						/>
          						
          						
          						<
          						property name
          						=
          						"testOnBorrow"
          						 value
          						=
          						"false"
          						/>
          						
          						
          						</
          						bean
          						>
          						
          						
          						<
          						bean id
          						=
          						"sqlSessionFactory"
          						 class
          						=
          						"org.mybatis.spring.SqlSessionFactoryBean"
          						>
          						
          						
          						<
          						property name
          						=
          						"dataSource"
          						 ref
          						=
          						"dataSource"
          						
          						
          						/>
          						
          						
          						<
          						property name
          						=
          						"configLocation"
          						 value
          						=
          						"classpath:mybatis/myBatisConfig.xml"
          						/>
          						
          						
          						</
          						bean
          						>
          						
          						
          						<
          						bean id
          						=
          						"sqlSessionTemplate"
          						 class
          						=
          						"org.mybatis.spring.SqlSessionTemplate"
          						>
          						
          						
          						<
          						constructor-arg ref
          						=
          						"sqlSessionFactory"
          						/>
          						
          						
          						</
          						bean
          						>
          						
          						
          						<
          						bean id
          						=
          						"transactionManager"
          						
              class
          						=
          						"org.springframework.jdbc.datasource.DataSourceTransactionManager"
          						
              p
          						:
          						dataSource-ref
          						=
          						"dataSource"
          						/>
          						
          						
          						<
          						tx
          						:
          						annotation-driven transaction-manager
          						=
          						"transactionManager"
          						/>

          And log4.properties is below:

          log4j . logger . org . springframework = DEBUG
          log4j
          . logger . org . apache = DEBUG
          log4j
          . logger . org . mybatis = DEBUG
          log4j
          . logger . java . sql = DEBUG
          log4j
          . logger . java . sql . Connection = DEBUG
          log4j
          . logger . java . sql . Statement = DEBUG
          log4j
          . logger . java . sql . PreparedStatement = DEBUG
          log4j
          . logger . java . sql . ResultSet = DEBUG

          With these configuration, I can see SQL query statement which is executed and parameters to that query but I can't see query result log. My log is like this:

          [ org . mybatis . spring . SqlSessionUtils ] - Creating a new SqlSession [ org . mybatis . spring . SqlSessionUtils ] - SqlSession

          [ org . apache . ibatis . session . defaults . DefaultSqlSession @ 4 ccdd1f ] was not registered for synchronization because synchronization is not active

          [
          org . springframework . jdbc . datasource . DataSourceUtils ] - Fetching JDBC Connection from DataSource

          [
          org . mybatis . spring . transaction . SpringManagedTransaction ] - JDBC Connection

          [
          ProxyConnection [ PooledConnection [ com . mysql . jdbc . JDBC4Connection @ 3 cfde82 ]]] will not be managed by Spring

          [
          java . sql . Connection ] - ooo Using Connection [ ProxyConnection [ PooledConnection [ com . mysql . jdbc . JDBC4Connection @ 3 cfde82 ]]]

          [
          java . sql . Connection ] - ==> Preparing : SELECT col FROM table WHERE col1 =? AND col2 =? [ java . sql . PreparedStatement ] - ==> Parameters : 93 ( Integer ), 4 ( Integer )

          [
          org . mybatis . spring . SqlSessionUtils ] - Closing non transactional SqlSession

          [
          org . apache . ibatis . session . defaults . DefaultSqlSession @ 4 ccdd1f ] [ org . springframework . jdbc . datasource . DataSourceUtils ] - Returning JDBC Connection to DataSource
          				
          posted on 2013-10-23 14:34 禮物 閱讀(826) 評論(0)  編輯  收藏

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

          網站導航:
           
          主站蜘蛛池模板: 镇巴县| 施秉县| 清原| 申扎县| 北京市| 客服| 武穴市| 蓬莱市| 鹿邑县| 花莲县| 葵青区| 宁陵县| 龙南县| 和龙市| 蕉岭县| 衢州市| 德兴市| 定兴县| 平远县| 犍为县| 新昌县| 泰宁县| 前郭尔| 方城县| 大庆市| 湄潭县| 辽宁省| 平昌县| 河北区| 大余县| 陆川县| 炉霍县| 福清市| 瑞昌市| 揭西县| 陆良县| 曲靖市| 莎车县| 兴化市| 城市| 皮山县|