浏览 3753 次
锁定老帖子 主题:求证:hql多条件from时丢失参数?
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-01-22
最后修改:2009-12-27
让hibernate输出生成的native sql发现 from PerformScript where key.pcd='123456' and key.interviewSheetNo='123456' and ( startDay=null or startDay='' or startDay<='20070122') and ( endDay=null or endDay='' or endDay>='20070122' )) and kind='pc' order by key.relatNo 生成的是 select performscr0_.p_code as p1_26_, performscr0_.sheet_no as sheet2_26_, performscr0_.relat_no as relat3_26_, performscr0_.kind as kind26_, performscr0_.script as script26_, performscr0_.start_day as start6_26_, performscr0_.end_day as end7_26_ from perform_script performscr0_ where performscr0_.p_code='123456' and performscr0_.sheet_no='123456' and (performscr0_.start_day is null or performscr0_.start_day='' or performscr0_.start_day<='20070122') and (performscr0_.end_day is null or performscr0_.end_day='' or performscr0_.end_day>='20070122') 其中kind='pc'丢失了。 但是如果切换一下顺序 from PerformScript where key.pcd='123456' and key.interviewSheetNo='123456' and kind='pc' and ( startDay=null or startDay='' or startDay<='20070122') and ( endDay=null or endDay='' or endDay>='20070122' )) order by key.relatNo select performscr0_.p_code as p1_26_, performscr0_.sheet_no as sheet2_26_, performscr0_.relat_no as relat3_26_, performscr0_.kind as kind26_, performscr0_.script as script26_, performscr0_.start_day as start6_26_, performscr0_.end_day as end7_26_ from perform_script performscr0_ where performscr0_.p_code='123456' and performscr0_.sheet_no='123456' and [b]performscr0_.kind='pc' [/b] and (performscr0_.start_day is null or performscr0_.start_day='' or performscr0_.start_day<='20070122') and (performscr0_.end_day is null or performscr0_.end_day='' or performscr0_.end_day>='20070122') 条件又出来了。 估计是hibernate的bug。 除非hibernate输出的sql有长度限制。 有碰到同样问题的xdjm没? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-01-22
没事用那么多个括号干什么?也没有or都是and需要么?
1. from PerformScript where key.pcd='123456' and key.interviewSheetNo='123456' and ( startDay=null or startDay='' or startDay<='20070122') and ( endDay=null or endDay='' or endDay>='20070122' )) and kind='pc' order by key.relatNo |
|
返回顶楼 | |
发表时间:2007-01-23
sql问题
|
|
返回顶楼 | |