1 Reply Latest reply on Jan 9, 2004 6:07 PM by Anthony Law

    JBossQL ORDER BY as Param?

    Anthony Law Newbie

      Hi all,

      I'm trying to feed in params for my ejbfinder using JBossQL. It works for WHERE, LIMIT, and OFFSET, but the param for ORDER BY is completely ignored (no exceptions thrown anywhere) & MySQL returns the unsorted collection.

      Is it valid to do so? Or would I have to use another approach, maybe a dynamic-ql?


      My jbosscmp-jdbc.xml entry:

      <![CDATA[Test finder]]>

      <![CDATA[unitHardwareId LIKE {0} AND partitionName LIKE {1} AND state LIKE {2}]]>
      <![CDATA[{3}]]> <![CDATA[LIMIT {4} OFFSET {5}]]>

      If I explicitly put in a column name, eg <![CDATA[PartitionName DESC]]>, then it'll work as expected.

      My JBoss log:

      2004-01-09 12:13:54,203 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCDeclaredSQLQuery.SMPEntity#findByFilter] Executing SQL: SELECT SMPEntity.Id, SMPEntity.UnitHardwareId FROM SMPEntity SMPEntity WHERE unitHardwareId LIKE ? AND partitionName LIKE ? AND state LIKE ? ORDER BY ? LIMIT ? OFFSET ?