• 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 syntax

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the follwing ejb-ql statements are correct or not?

SELECT OBJECT(c) FROM customer c, IN(o.order) o
SELECT OBJECT(c) FROM customer AS c, IN(o.order) o
SELECT OBJECT(c) FROM customer AS c, IN(o.order) AS o
SELECT OBJECT(c) FROM customer c IN(o.order) o
(note: In the fourth query "," is removed)
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would believe all of them are correct... EJB Geeks, correct me if I am wrong.
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though I am not EJB or EJB-QL expert but to me all of the four queries seem be wrong. Where is this "o" declared/defined in the query? "c" is placeholder/alias for "customer". What does "o" represent?

SELECT OBJECT(c) FROM customer c, IN(o.order) o
SELECT OBJECT(c) FROM customer AS c, IN(o.order) o
SELECT OBJECT(c) FROM customer AS c, IN(o.order) AS o
SELECT OBJECT(c) FROM customer c IN(o.order) o

 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the queries are incorrect. I think, the query to "select the customers who have at least one order" should look like this:

SELECT OBJECT(c) FROM Customer c, IN(c.order) o

For the four queries below, I think you are trying to write the same query in four different ways. Not sure about the third and the fourth syntax.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic