• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Bear Bibeault
  • paul wheaton
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Mikalai Zaikin
  • Piet Souris
Bartenders:

is this orderby query right? as i am getting an error

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the query:
<query>
<query-method>
<method-name>findAllWithConstraint</method-name>
<method-params/>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(o) FROM users AS o ORDERBY o.iD
DESC]]></ejb-ql>
</query>
This is the error:
weblogic.ejb20.cmp.rdbms.finders.IllegalExpressionException:
While trying to process Finder
Method Name: findAllWithConstraint
Parameter Types: ()
EJB Query: SELECT OBJECT(o) FROM users AS o ORDERBY o.iD DESC
)
Could not parse EJB QL expression: SELECT OBJECT(o) FROM users AS o
ORDERBY o.iD DESC
Please tell me the problem with this query
Ronak Parekh
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no support for ORDER BY CLAUSE in EJBQL.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ORDER BY clause is supported in EJB 2.1
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a few choices:
  • Use a proprietary extenstion to CMP like WLQL.
  • Sort the Collection or Set after it is returned.
  • Skip CMP altogether and just use Session + DAO for those queries that don't map nicely.


  • CMP does not cover everything that you could possibly need. It does however get you 80% to 90% of the way there in most cases. For those exceptions there is always DAO.
     
    And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
    Low Tech Laboratory
    https://www.kickstarter.com/projects/paulwheaton/low-tech-0
    reply
      Bookmark Topic Watch Topic
    • New Topic