HTML and CSS Reference
In-Depth Information
(String) bookInfo[5],
null);
books.add(book);
}
return books;
}
//...
}
The other methods of BookManager EJB are as follows:
getBookInformation : Gets the metadata of the topic (the topic data without the topic
contents). It throws BookNotFound exception if the target book is not found.
getBookContent : Gets only the topic content as a byte array. It throws BookNotFound exception
if the target book is not found.
removeBook : Removes the topic from the database. It throws BookNotFound exception if the
target book is not found.
getAllBooks : Takes a book object as a parameter for allowing the API to search with any of the
book attributes. However, for now, the getAllBooks() implementation searches using only
the title attribute of the topic, using the SQL like operator. If there are no results, the API
returns an empty list.
Now, let's check the details of Book JPA entity which holds the topic attributes and the validation constraints
which use Java Bean Validation APIs. Listing 13-6 shows Book JPA entity code.
Listing 13-6. Book JPA Entity
package com.jsfprohtml5.megaapp.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
 
Search WWH ::




Custom Search