mybaits sql查询有数据 映射时返回结果却是null 为什么呢求指导

J2EE 码拜 7年前 (2017-04-30) 2963次浏览
<select id=”TestSelect” resultType=”guet.com.po.Document”>
SELECT * FROM document WHERE (doc_id =2)
</select>
日志:
DEBUG  [http-apr-8080-exec-2] – JDBC Connection [435841503, URL=jdbc:mysql://localhost:3306/instru_sys, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
DEBUG  [http-apr-8080-exec-2] – ==>  Preparing: SELECT * FROM document WHERE (doc_id =2)
DEBUG  [http-apr-8080-exec-2] – ==> Parameters:
DEBUG  [http-apr-8080-exec-2] – <==    Columns: doc_id, doc_numb, doc_time, doc_type, check_p
DEBUG  [http-apr-8080-exec-2] – <==        Row: 2, 0002, 2017-04-21 15:05:38.0, 0, ??
DEBUG  [http-apr-8080-exec-2] – <==      Total: 1
DEBUG  [http-apr-8080-exec-2] – Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3637a3fd]
DEBUG  [http-apr-8080-exec-2] – Returning JDBC Connection to DataSource
DEBUG  [http-apr-8080-exec-2] – Don”t need to create transaction for [guet.com.service.impl.DocumentServiceImpl.GetMaxid]: This method isn”t transactional.
DEBUG  [http-apr-8080-exec-2] – Creating a new SqlSession
DEBUG  [http-apr-8080-exec-2] – SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@53914c10] was not registered for synchronization because synchronization is not active
DEBUG  [http-apr-8080-exec-2] – Fetching JDBC Connection from DataSource
DEBUG  [http-apr-8080-exec-2] – JDBC Connection [1214379398, URL=jdbc:mysql://localhost:3306/instru_sys, UserName=root@localhost, MySQL-AB JDBC Driver] will not be managed by Spring
DEBUG  [http-apr-8080-exec-2] – ==>  Preparing: SELECT MAX(doc_id) FROM document
DEBUG  [http-apr-8080-exec-2] – ==> Parameters:
DEBUG  [http-apr-8080-exec-2] – <==    Columns: MAX(doc_id)
DEBUG  [http-apr-8080-exec-2] – <==        Row: 5
DEBUG  [http-apr-8080-exec-2] – <==      Total: 1
DEBUG  [http-apr-8080-exec-2] – Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@53914c10]
DEBUG  [http-apr-8080-exec-2] – Returning JDBC Connection to DataSource
null
IN20174215
DEBUG  [http-apr-8080-exec-2] – Method [selecttest] returned [null]
解决方案

40

resultType=”guet.com.po.Document”
数据库的字段和实体类对应吗?

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明mybaits sql查询有数据 映射时返回结果却是null 为什么呢求指导
喜欢 (0)
[1034331897@qq.com]
分享 (0)