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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
crolip
Posts: 6
Joined: Mon Jun 16, 2014 9:47 am
Contact:

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

Post by crolip »

On this option:

Code: Select all

CriteriaQuery q = cb.createQuery();
 Root<Order> c = q.from(Order.class); 
Join<Order, Customer> o = c.join(Order_.customer); 
q.orderBy(cb.asc(o.get(Order_.quantity)).asc(c.get(Customer_.name)));
 q.select(cb.tuple(o, c.get(Customer_.name)));
Are said: Since it is specified in the problem statement that Customer/Order is a unidirectional relationship, you should assume that there is no customer field in Order. Therefore, you cannot join order with customer. Had the relationship been bidirectional, this would have been a valid option.

But, asc() and desc() methods are available in CriteriaBuilder and not on Path?

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

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

Post by admin »

Yes, asc and dsc are present in CriteriaBuilder: https://docs.oracle.com/javaee/6/api/ja ... xpression)
If you like our products and services, please help us by posting your review here.

crolip
Posts: 6
Joined: Mon Jun 16, 2014 9:47 am
Contact:

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

Post by crolip »

Ok, so we could not use asc from Path.

q.orderBy(cb.asc(o.get(Order_.quantity)).asc(c.get(Customer_.name)));

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

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

Post by admin »

You are right. That would be wrong as well.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests