This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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
Author

[SCBCD 5.0] Simplified (reduced) SELECT clause form

Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3213
    
    6
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 ?

Thanks,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam 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
Greenhorn

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

Joined: Jun 04, 2002
Posts: 3213
    
    6
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.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [SCBCD 5.0] Simplified (reduced) SELECT clause form