| Author |
HF Page434 Q. 12
|
Purvesh Vora
Ranch Hand
Joined: Dec 10, 2003
Posts: 47
|
|
Hi Friends, The Q.12 is Given CMP beans CustomerBean, OrderBean and LineItemsBean with the following relationships: CustomerBean (1) <--> OrderBean (n) OrderBean(1) <--> LineItemsBean(n) Which will return all orders that have line items? (Choose all that apply.) A. SELECT DISTINCT o FROM Order o, IN (o.lineItems)li B. SELECT DISTINCT OBJECT(O) FROM Order o, IN(o.lineItems) li C. SELECT OBJECT(o) FROM Order o WHERE o.lineItems = 0 D. SELECT OBJECT(o) FROM Order o The correct answers are listed as B and D. B is fine. But how the answer D is TRUE? Could anybody please explain? Thanks.
|
Regards,<br />Purvesh<br />SCJP, SCBCD, IBM Exam #486
|
 |
Kin Ng
Greenhorn
Joined: May 06, 2005
Posts: 16
|
|
I think it's the wording of the question. It says "will return all orders that have line items" (didn't say only). The set "all orders that have line items" is definitely a subset of the resultset of Query D, which contains all orders. That's why D is correct too. This is what I think.
|
 |
David McDonagh
Greenhorn
Joined: Feb 13, 2004
Posts: 19
|
|
|
Actually can someone explain why Option B is correct? My naive understanding that the syntax DISTINCT would only return one object and not a collection i.e. "all orders with lineitems".
|
 |
Sumitro Palit
Ranch Hand
Joined: Dec 13, 2003
Posts: 37
|
|
|
DISTINCT implies duplicates will be avoided - it can still return a collection of unique records staisfying the QL statement.
|
 |
 |
|
|
subject: HF Page434 Q. 12
|
|
|