Hi Evan,
Thanks for your reply.
Since its a one to one relation, the ejbql will be something like this.
select object(c) from Customer c, Address a where a.iD=?1;
Please check the following SQL code generated by j2ee;
Select c.name from Customer c, Address A where a.iD=?
How abt the sql generated by other app servers for the above ejbql?
Karthik
-----Original Message-----
From: Evan Ireland [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 AM 02:22
To: Karthik M.
Cc: [EMAIL PROTECTED]
Subject: Re: EJBQL and SQL
Karthik M. wrote:
> Hello All,
> If my ejbquery is
> Select Object(c) from Customer c, Address a ;
> Which of the following sql queries is correct?
> a) Select c.name from Customer c, Address a;
> b) Select c.name from Customer c, Address a where
> c.fk_addressID= a.addressID;
>
> In mastering EJB 2 (pg 573) , it is said that first one is
> correct.But I feel that second one is correct because duplicates are
> removed.
>
> Please help me.
If Customer has a cmr-field named address, you can avoid the 'duplicates'
(cartesian product) by writing EJB QL as:
select object(c) from Customer c, in(c.address) a
That query could then correspond to the SQL (b).
> TIA
> Karthik.
>
>
>
>
>
>
> --------------------------------------------------------------------------------------------------------------------
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom
> they are addressed. If you have received this email in error please
> notify the
> originator of the message.
>
> Any views expressed in this message are those of the individual
> sender, except where the sender specifies and with authority,
> states them to be the views of Huawei Technologies India Pvt. Ltd.
--
_______________________________________________________________________________
Evan Ireland Sybase EAServer Engineering [EMAIL PROTECTED]
Wellington, New Zealand +64 4 934-5856
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please notify the
originator of the message.
Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Huawei Technologies India Pvt. Ltd.
