JBOSS-QL中的like、orderby的实现

发表于:2007-06-22来源:作者:点击数: 标签:
在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> 在j boss cm

   
  在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>

原文转自:http://www.ltesting.net