File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes [SCBCD 5.0] Simplified (reduced) SELECT clause form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "[SCBCD 5.0] Simplified (reduced) SELECT clause form" Watch "[SCBCD 5.0] Simplified (reduced) SELECT clause form" New topic

[SCBCD 5.0] Simplified (reduced) SELECT clause form

Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3322
Howdy !

I've seen in some places the reduced form of SELECT clause, like :

while the "full" form defined by spec is as follows:

So, the question is: where this "simplified" form of SELECT came from ? Is id defined in EJB 3.0 spec, maybe I overlooked it ?


Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Exam 1Z0-810: Upgrade to Java SE 8 Programmer Study Guide and Quiz
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Hello Mikalai,

don't know about the source of this strange abbreviation of queries, but the persistence specification is 100% precise (see 4.14, Query Language BNF):

which means that the SELECT clause is NOT optional, and anybody who writes and implements a query without SELECT (JBoss server and tutorials come to mind ), is deviating from the spec.
Yevgen Bushuyev

Joined: Dec 10, 2002
Posts: 9
That's hibernate
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3322
Originally posted by Yevgen Bushuyev:
That's hibernate

Yevgen, thanks a lot !

AFAIK, JBoss uses Hibernate as JPA provider, so simplified SELECT queries are Ok for JBoss, but not Ok for other servers...
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
I have used this form of queries(i.e without select) while working with hibernate. In those cases it returns all entities mentioned in FROM clause.
According to ejb3.0 spec both select and from clauses are mandatory.
May be JBoss server support this form of queries as extra benefits. But such queries definitely will not be portable across application servers.

I agree. Here's the link:
subject: [SCBCD 5.0] Simplified (reduced) SELECT clause form
It's not a secret anymore!