• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB-QL and JBOSS-QL

 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a working EJB-QL declared in the ejb-jar.xml like the following:

<query>
<query-method>
<method-name>findByClient</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql>
SELECT OBJECT(d) FROM PartSchema d WHERE d.partClient = ?1
</ejb-ql>
</query>

Now, I want to get the search result sorted. I think I can achieve that using JBOSS-QL.

I have been trying declaring the jboss-ql in jbosscmp-jdbc.xml like this

<query>
<query-method>
<method-name>findByClient</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<jboss-ql><![CDATA[SELECT OBJECT(d) FROM PartSchema d ORDER BY d.partID WHERE d.partClient = ?1 DESC]]>
</jboss-ql>

</query>

But, it won't deploy.

Does anyone have any example how to use Jboss-ql ? Any tips is greatly appreciated here. Oh btw, I use jboss-3.2.5

TIA
-Vili
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error do you get when you try to depploy it? Maybe the order by needs to go at the end of the query...



Here's an example from one of my JBOSS xml



I know this works because the data is then used by a graphics routine...if the ORDER BY wasn't working it would be joining dots randomly instead of forming lines from them...which it was doing for a while before I realised my colleague had left the ORDER BY out and just used EJB-QL :roll:

If you can't get it to work for you you could sort the results in Java, but I believe I read that is a slower way of doing it, and will also involve you writing extra code.
[ August 23, 2004: Message edited by: Ben Wood ]
 
Vili Leonardo
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thanks for the reply. That's it, the "order by" should be at the end of the select statement.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!