• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB QL syntax

 
Ramakrishnan Ponmudi
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)
 
Muthaiah Ramanathan
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.
 
Saeed Amer
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

 
Ankit Doshi
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!