容易忽略的Tomcat安全问题- -| 回首页 | 2005年索引 | - -[转]如何用正确的方法来写出质量好的软件的75条体会

Hibernate 3 HQL语句in clause绑定参数的写法- -

                                      

in条件比较特殊,除了使用setParameterList方法,另外占位符还需要使用“()”括起来,否则会报错.

 

 

Hibernate: HQL and assigning values to an in () clause This took me a while to find so I'll document it here.

Here's an example:

q = s.createQuery("from Request req where req.requestTypeCode = :code      and req.approver.entityId in (:entityIds)");
q.setString("code", Constants.REQUEST_TYPE_NEW);
q.setParameterList("entityIds", approverIds);
 

 

URL: http://jroller.com/page/geyerba/20050421

 

- 作者: 香山叶 访问统计: 2005年06月14日, 星期二 11:00 加入博采

Trackback

你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=1914345

评论内容: