EJB 3 in Action, end of page 360 & starting of 361
You can navigate further to other persistence fields or association fields using
a single-value path expression. For example, say we have a many-to-one relationship
between Category and User; we can navigate to a persistence field such as
firstName using association field user as follows:
1
c.items.user.firstName
We may also want to navigate to the association field contactDetails to use its
e-mail address:
1
c.items.user.contactDetails.email
While using path expressions, keep in mind that you cannot navigate through the
collection-value path expressions to access a persistence or association field as in
the following example:
2
c.items.itemName or c.items.seller
This is due to the fact you cannot access an element of a Collection, and items is
in fact is a collection of items. Using c.items.itemName in JPQL is similar to using
category.getItems().getItemName(), and this is not allowed.
Doubt:
I am not able to understand difference between two cases....
c.items.user is valid
c.items.seller is not valid
Please share your thoughts (interperate in your words).....
thanks....