ibatis问题:急!!!一条sql语句控制台正常返回结果,但是在ibatis中却返回空

s_topman 2007-04-09 04:31:01
有这样一条sql语句:
select a.id as id, u1.user_name as sndr_name, u2.user_name as rcvr_name, a.grade as grade, a.status as status, a.be_read as be_read, a.send_time as send_time, a.summary as summary from assignment a, user u1, user u2
where u1.user_name like %宋% and a.sndr_id = u1.user_id and u2.user_id = a.rcvr_id;
在控制台执行返回六条记录,把它写在ibatis的配置文件中却返回零条记录.我观察了以下问题发生在 "u1.user_name like %宋%"这里,把这段去掉,则在ibatis中也能正常返回记录.
请问:熟悉ibatis的朋友,这是什么问题呢?该如何解决?谢谢!!!
...全文
296 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
s_topman 2007-04-09
  • 打赏
  • 举报
回复
已解决
s_topman 2007-04-09
  • 打赏
  • 举报
回复
确实是中文编码问题,可是如何解决呢?改用ibatis前一切都正常,数据库编码latin1,网页编码都是gb2312
liujs1026 2007-04-09
  • 打赏
  • 举报
回复
where u1.user_name like like '%$user_name$%',变量要用$,而不能用#
YANGWU210 2007-04-09
  • 打赏
  • 举报
回复
中文编码的问题!看看你的文件保存的格式,还有数据库的存取格式!最好全用UTF-8
OR GB2312

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧