• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[SCBCD 5.0] Simplified (reduced) SELECT clause form

 
Mikalai Zaikin
Ranch Hand
Posts: 3365
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's hibernate
 
Mikalai Zaikin
Ranch Hand
Posts: 3365
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic