Let's code the business methods to add, delete and retrieve the Book Entity Beans objects.


The add method simply calls persist on the EntityManager to add a newly instantiated and populated Book Entity Bean POJO.


In the delete method we first find the book by its id and then delete it by calling remove on the EntityManager, passing in the book object.


The getBooks method uses simply EJB-QL to get all Book entities from the database.





                    

Copyright © 2013 VisualBuilder. All rights reserved