From the course: Java EE 8 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Advanced entity management - Java EE Tutorial
From the course: Java EE 8 Essential Training
Advanced entity management
- [Instructor] In order to be successful with JPA, you should be very familiar with the entityManager and its operations. Let's take a closer look at those operations in this lesson. So you'll notice that we've expanded our EJB interface to include some additional methods. So now we're able to find a CatalogItem by its ID, we're also able to delete a CatalogItem, and then we're able to search for CatalogItems by their name. So when we expanded that interface, we also had to include some stub methods within our EJB implementation. And we're going to spend some time completing the implementations for those methods. So the first thing we want to do is find an item by its ID. And it's really easy using the entityManager to do that. So it has a find method. And all we need to do is provide the type of the entity, so in this case we're going to supply the CatalogItem class and then we pass in the ID, and that's all there is to it.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.