About Question enthuware.oce-jpad.v6.2.579 :

Moderator: admin

Post Reply
tioola
Posts: 6
Joined: Mon Sep 23, 2013 5:19 pm
Contact:

About Question enthuware.oce-jpad.v6.2.579 :

Post by tioola »

This question is saying that there are 2 Customers and each Customer has 3 Orders, the correct question is saying that list will contain 12 , In my understand it should be 6 2x3=6

Am I missing something?

THanks.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.579 :

Post by admin »

Each customer has three orders. So there are 6 orders.
-Paul.
If you like our products and services, please help us by posting your review here.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-jpad.v6.2.579 :

Post by himaiMinh »

In the explanation :
The above code can be fixed to return only those customers who have at least one order by added a where clause like this:
cq.where(cb.equal(custRoot, orderRoot.get("customer")));
I guess this can be this:
"cq.where(cb.equal(custRoot, orderRoot.get("customer"))).distinct(true);
to avoid duplicates.

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests