June 2018
Intermediate to advanced
596 pages
12h 39m
English
Now that we have all data access classes ready, we need to connect the user interface that we have created for adding courses, addCourse.xhtml, to pass data and get data from the JPA service classes. As mentioned previously, we are going to do this using managed beans, in this case, CourseServiceBean.
CourseServiceBean will need to create an instance of CourseService and call the addCourse method. Open CourseServiceBean and create a member variable as follows:
private CourseService courseService ;
We also need an instance of the EntityManagerFactoryBean managed bean that we created earlier:
@ManagedProperty(value="#{emFactoryBean}")
private EntityManagerFactoryBean factoryBean;
The factoryBean ...