在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>
查看本文来源