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>