Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

EJB QL syntax

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
I will suppress my every urge. But not this shameless plug:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic