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 ]
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
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?