posted 18 years ago
Find all orders in which the shipping address differs from the billing address. This example assumes that the Bean Provider uses two distinct entity beans to designate shipping and billing addresses:
SELECT OBJECT(o)
FROM Order o
WHERE NOT
(o.shipping_address.state = o.billing_address.state AND
o.shipping_address.city = o.billing_address.city AND
o.shipping_address.street = o.billing_address.street)
If the Bean Provider uses a single entity bean in two different relationships for both the shipping address and the billing address, the above expression can be rewritten as:
SELECT OBJECT(o)
FROM Order o
WHERE o.shipping_address <> o.billing_address
My question:
Suppose I am using the 2nd version, how will the container do the comparsion, will it compare the primary keys?? or all the cmp-field??
Thanks.