• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Significance of OBJECT() in EJB-QL

 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Select * from Person!!!


I would never use * in my query.
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic