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 礼物 阅读(813) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。

网站导航: