• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB-QL and JBOSS-QL

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic