JBOSS-QL中的like、order by的实现
2008-01-05 10:06:16 来源:WEB开发网核心提示:在ejb-jar.xml下加入如下代码: < entity>.......< query>< query-method>< method-name>findByNameLike< /method-name>< method-params><
在ejb-jar.xml下加入如下代码:
< entity>
.......
< query>
< query-method>
< method-name>findByNameLike< /method-name>
< method-params>
< method-param>Java.lang.String< /method-param>
< /method-params>
< /query-method>
< ejb-ql />
< /query>
< /entity>
在jbosscmp-jdbc.xml下加入如下代码:
< entity>
......
< query>
< query-method>
< method-name>findByNameLike< /method-name>
< method-params>
< method-param>java.lang.String< /method-param>
< /method-params>
< /query-method>
< jboss-ql>select object(c) from County as c where c.name like concat('%',concat(?1,'%')) order by c.id desc< /jboss-ql>
< /query>
< /entity>
更多精彩
赞助商链接