Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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: 102
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic