• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Significance of OBJECT() in EJB-QL

 
Rishi Singh
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Can anyone explain me the significance of OBJECT() in EJB-QL. Why do we need to specify for examlpe "Select OBJECT(p) from Person" when we can also
do the same thing with "Select p from Person".
Rishi
SCJP,SCWCD,IBM OOAD
[ October 31, 2003: Message edited by: Rishi Singh ]
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Orielly book
When questioned about this, Sun replied that several vendors had requested the use of the OBJECT() operator because it will be included in the next major release of the SQL programming language.
 
Prashant Satarkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rishi,
As the example you have given select OBJECT(P) from Person p. In this the the OBJECT() operator is required when select type is a single identifier for an entity bean. it is not required when select type is a path like:
SELECT p.lastName FROM Person AS p. For such a ql, OBJECT operator is not needed.
In other words: The identifier OBJECT in the SELECT clause is required, because the OBJECT operator must qualify all stand-alone identification variables in the SELECT clause.
Prashant
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not too happy about the vendor's request. Sun could have made the vendors happy in the future releases,EJB 3.0 or later.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vish Kumar:
I am not too happy about the vendor's request. Sun could have made the vendors happy in the future releases,EJB 3.0 or later.

Your chance is here
http://weblogs.java.net/pub/wlg/317
 
krithika desai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i understand rishi's query properly, Is'nt he questioning this? -->
Originally posted by Prashant Satarkar:

In other words: The identifier OBJECT in the SELECT clause is required, because the OBJECT operator must qualify all stand-alone identification variables in the SELECT clause.


Either way guess OBJECT is not required for
SELECT p.company FROM Person AS p
where company is a CMR with Company entity bean.
So Rishi if I understand your question correctly, are you saying that when OBJECT is not used here to identify the Company bean why is it needed to indentify the Person bean in the query you posted?
 
Rishi Singh
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prashant,
I think no one does stops you from writing "Select p from Person" . Your comment over path traversal holds good but Iam afraid not about OBJECT().
Rishi
SCJP,SCWCD,IBM OOAD
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:

Your chance is here
http://weblogs.java.net/pub/wlg/317

Thanks Pradeep for the link,
I wish you had given me this link 2 yrs ago and I could have influenced Sun's idea of Object
Select * from Person!!!
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Select * from Person!!!

I would never use * in my query.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic