2 Replies Latest reply on Sep 18, 2003 3:46 AM by allanic

    Help: why 'ORDER BY' clause in dynamic-ql has no effect?

    allanic Newbie

      I'm using dynamic query with JBoss3.2.1 just like:
      "SELECT OBJECT(a) FROM Customer AS a ORDER BY a.code", but why the entites returned are not sorted?

      following is declared in my jbosscmp-jdbc.xml:

      <query-method>
      <method-name>ejbSelectGeneric</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.Object[]</method-param>
      </method-params>
      </query-method>
      <dynamic-ql />


      when I change dynamic-ql to jboss-ql as following:

      <query-method>
      <method-name>findAll</method-name>
      <method-params/>
      </query-method>
      <jboss-ql>
      <![CDATA[SELECT OBJECT(a) FROM Customer AS a ORDER BY a.code]]>
      <jboss-ql>

      the result is sorted as expected.

      ps: my database env is MySQL 4.1.0