Which one of the following queries selects the customer whose order has the highest total price?

Which one of the following queries selects the customer whose order has the highest total price?
A. CriteriaBuilder cb = …Criteria Query <Customer> cq = cb.create Query (Customer.class);Root<Customer> c = cq.from (Customer.class);Join<Customer, Order> o =
B. join(Customer__.orders);cq.select(c).distinct(true);Subquery<Double> sq = cq.subquery(Double.class);Root<Order> subo = cq.correlate(o);sq.select(cb.max(subo.get(Order_.totalPrice)));cq.where(cb.equal(o.get(Order_.totalPric e), cb.all(sq)));
C. CriteriaBuilder cb = …CriteriaQuery<Customer> cq = cb.createquery(customer.class)Root<Customer> c = cq.from(Customer.class);Join<Customer, Order> o = c.join(Customer__.orders);cq.select (c).distinct(true);Subquery<Double> sq = cq.subquery(Double.class);Root<Order> subo = cq.correlate(o);sq.select(cb.max(subo.get(Order_.totalPrice)));cq.where(cb.equal(o.get(Order_.totalPric e), cb.all(sq)));
D. CriteriaBuilder cb = …CriteriaQuery<Customer> cq = cb.cteateQuery(Customer.class);Root<Customer> c = cq.from(Customer.class);Join<Customer, Order> o = c.join(Customer__.orders);cq.select (c).distinct(true);Subquery<Double> sq = cq.subquery(Double.class);Root<Order> subo = cq.correlate(o);sq.select(cb.max(subo.get(Order_.totalPrice)));cq.where(cb.equal(o.get(Order_.totalPric e), cb.all(sq)));
E. CriteriaBuilder cb = …CriteriaQuery<Customer> cq = cb.createQuery(Customer.class);Root<Customer> c = cq.from(Customer.class);Join<Customer, Order> o = c.join(Customer_.orders);cq.select (c).distinct(true);Subquery<Double> sq = cq.subquery(Double.class);Root<Order> subo = sq.from(Order.class);sq.select (cb.max ( subo.get (Order_. Total Price) ) ) ;cq.where(sq.all(o.get(Order_.totalPrice)));

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.