HTML and CSS Reference
In-Depth Information
status : An integer field to represent the request status. It can have one of three values
(1 for pending, 2 for rejected, and 3 for approved).
userId : Represents the request associated user object.
bookId : Represents the request associated book object.
These are the available three service EJBs; as can be noticed in the previous code snippets, many methods of the
manager EJBs throw instances of the following custom exceptions:
All of these custom exceptions inherit from java.lang.Exception . Listing 13-16 shows BookAlreadyExists
exception as an example.
Listing 13-16. BookAlreadyExists Exception
package com.jsfprohtml5.megaapp.service.exception;
import javax.ejb.ApplicationException;
public class BookAlreadyExists extends Exception {
public BookAlreadyExists () {
this.message = "Book already exists";
public BookAlreadyExists(String message) {
this.message = message;
public String getMessage() {
return this.message;
private String message;
it is recommended to annotate custom application exception with @ApplicationException in order to avoid
having them wrapped in container exceptions. Doing this will allow the eJB client to catch the thrown exceptions directly
without having to unwrap container exceptions.
Search WWH ::

Custom Search