0 Replies Latest reply on Aug 17, 2005 6:54 AM by catherine lo

    retrieve more than one columns using declared-sql

    catherine lo Newbie

      I am using JBoss 4.0.1SP1 and mysql

      I have this JBoss declared-sql :
      SELECT c.Status, Month(c.firstUsed), COUNT(c.serialNumber) FROM Card c WHERE c.status = 4 GROUP BY Month(c.firstUsed)

      here is my jbosscmp-jdbc.xml:

      <query-method>
      <method-name>ejbSelectCountCardsUsed</method-name>
      <method-params>
      </method-params>
      </query-method>
      
      <declared-sql>
      < select >
      <ejb-name><![CDATA[Card]]></ejb-name>
      <field-name><![CDATA[status]]></field-name>
      < alias ><![CDATA[c]]>< /alias >
      <additional-columns><![CDATA[, Month(c.firstUsed), COUNT(c.serialNumber)]]></additional-columns>
      < /select >
      < where ><![CDATA[ c.status = 4 GROUP BY Month(c.firstUsed)]]>< /where >
      </declared-sql>
      


      Is there anyway I can read these Month(c.firstUsed), COUNT(c.serialNumber) from the collection returned by this query?