This is a question from the final mock exam of HFEJB. I am going for exam tomorrow morning, so it will be greatly appreciated if someone can answer this before tomorrow morning (to be more specific, in around 7 hours from now on)
The Q58 of HFEJB: Given CMP beans CustomerBean(CB), OrderBean(OB) and LineItemsBean(LIB) with relationships: CB(1) -> OB(n) OB(1) -> LIB(n)
Which will return set of customers that have orders? Correct answer given is: select distinct object(c) from Customer c, Order o where c.custnum=o.custnum.
How is this a valid query??? Customer to Order is 1 to many, so the right query should be select distinct object(c) from Customer c, IN (c.Order) o;
See the similar example given on page 236 of the spec?
select distinct object(c) from Customer c, Order o where c.custnum=o.custnum.
actually intension of using relationship is to retrieve data from more than one table.a well formed queury always should work whether it is one-one one-many. and EJB-QL is replica of Standard SQL except some oo benifits like traversing..etc.. so above ejb-query will give the expected result.