• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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.
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic