米巴蒂斯:
不知道出了什么问题。但是基本的 SelectOne 没有返回结果。
映射器:
<select id="getBackLog" parameterType="string"
resultType="string">
select data_key from yfs_task_q where task_q_key = #{value}
</select>
方法:
dataKey = (String) session.selectOne("OMSWatchMappers.getBackLog", agent); logger.debug("@Backlog=" + dataKey);
日志:
02:01:34.786 [main] DEBUG o.a.i.t.jdbc.JdbcTransaction - Openning JDBC Connection
02:01:35.890 [main] DEBUG o.a.i.d.pooled.PooledDataSource - Created connection 2092843500.
02:01:35.961 [main] DEBUG c.b.o.r.OMSWatchMappers.getBackLog - ooo Using Connection [oracle.jdbc.driver.T4CConnection@7cbe41ec]
02:01:35.961 [main] DEBUG c.b.o.r.OMSWatchMappers.getBackLog - ==> Preparing: select data_key from yfs_task_q where task_q_key = ?
02:01:36.126 [main] DEBUG c.b.o.r.OMSWatchMappers.getBackLog - ==> Parameters: 201101070640191548867209(String)
02:01:36.249 [main] DEBUG OMSWatchDAOImpl - @Backlog=null
02:01:36.250 [main] DEBUG o.a.i.t.jdbc.JdbcTransaction - Resetting autocommit to true on JDBC Connection [oracle.jdbc.driver.T4CConnection@7cbe41ec]
02:01:36.250 [main] DEBUG o.a.i.t.jdbc.JdbcTransaction - Closing JDBC Connection [oracle.jdbc.driver.T4CConnection@7cbe41ec]
02:01:36.250 [main] DEBUG o.a.i.d.pooled.PooledDataSource - Returned connection 2092843500 to pool.
该记录存在于数据库中。
select data_key from yfs_task_q where task_q_key = '201101070640191548867209';
DATA_KEY
------------------------
201101070636011548866830
如果我更改映射器以直接添加参数,它会返回结果。
映射器:
<select id="getBackLog" parameterType="string" resultType="string">
select data_key from yfs_task_q where task_q_key = '201101070640191548867209'
</select>
日志:
02:38:52.746 [main] DEBUG c.b.o.r.OMSWatchMappers.getBackLog - ==> Preparing: select data_key from yfs_task_q where task_q_key = '201101070640191548867209'
02:38:52.942 [main] DEBUG c.b.o.r.OMSWatchMappers.getBackLog - ==> Parameters:
02:38:53.096 [main] DEBUG OMSWatchDAOImpl - @Backlog=201101070636011548866830
我在这里缺少一些基本的东西。任何帮助指出将不胜感激。