>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?
If you want the address listed to be the customer's address (for a one-to-one relationship), the best way to represent this in EJB-QL is: select object(c) from Customer c where c.address.ID = ?1; The syntax above shows how EJB-QL makes it very easy and convenient to traverse container managed relationships (CMRs) in a query, as explicitly performing the join is not required. If you instead say: select object(c) from Customer c, Address a where a.ID = ?1; Here, the address is NOT explicitly linked to the customer and can represent any address in the database, which is most likely NOT the desired result. Doug =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
