February 2014
Beginner
1248 pages
62h 25m
English
In Fig. 29.3, lines 49–50 use EntityManager method createNamedQuery to create a TypedQuery that returns the result of the "Titles.findAll" query. Then, lines 56–68 display each title followed by that title’s list of author names. Line 56 calls the TypedQuery’s getResultsList method to perform the query. We create a Stream that sorts the Titles entities by title. Next, we invoke the Stream’s forEach method to display each Titles entity’s title and the corresponding list of authors. Once again, the lambda expression uses the autogenerated methods of class Titles and class Authors to access the entity data that’s displayed.
Read now
Unlock full access