• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

some questions about EJBQL

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am now using CMP for getting data from database. I find that it is qute unconvenient to use EJBQL to select records, comparing with SQL statement. e.g. it can't do the sorting task.
Now I have some questions to some EJBQL. For those questions, it is very easy to use SQL statement to do it (I don't want to use BMP, though I think BMP can do such tasks). How can I do such task by the use of CMP?
1) how can I select the largest value for a field of a table? (e.g. in SQL statement, SELECT MAX(col1) FROM table1) in EJBQL, I know that I can use SELECT OBJECT(o) FROM table1 and then use get the largest value in session bean, but it seems that it is quite slow.
2) how can I get a column only in a table? (e.g. in SQL statement, SELECT col1 FROM table1). However, in EJBQL, I can use SELECT OBJECT(o) FROM table1. I can obtain the whole record only, but I want to get a specific column only.
3) how can I count the number the records? (e.g. SELECT COUNT(*) FROM table1 where col1="test")
Thanks!
Stephen Lee
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic