HTML and CSS Reference
In-Depth Information
Rejecting a book request by an application administrator.
Removing a book by an application administrator.
User Manager EJB is responsible for handling the user management operations, which are
Registering a Mega App user.
Getting a Mega App user information.
Removing a Mega App user.
Retrieving Mega App users.
Listing 13-2 shows the persistence.xml file (located under /resources/META-INF ). persistence.xml file uses
JPA version 2.1 and it defines the "megaAppUnit" persistence unit that uses "JTA" transaction type. Using "JTA"
transaction type means that the container will handle the EntityManager creation and tracking for you, and you can
obtain its instance using @PersistenceContext annotation. JTA data source is set to jdbc/mega data source, using
which we will be able to access the Mega App database.
Listing 13-2. persistence.xml File
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns=" "
xmlns:xsi=" "
xsi:schemaLocation=" " >
<persistence-unit name="megaAppUnit" transaction-type="JTA">
it is good to note that in Java ee 7, most of the deployment descriptor namespaces are changed from the prefix
to to .
Listing 13-3 shows the EJB interface of BookManager EJB, which is defined as an EJB Local interface using
@Local annotation.
Listing 13-3. EJB Local Interface of BookManager EJB
package com.jsfprohtml5.megaapp.service;
import com.jsfprohtml5.megaapp.model.Book;
import com.jsfprohtml5.megaapp.service.exception.BookAlreadyExists;
import com.jsfprohtml5.megaapp.service.exception.BookNotFound;
import java.util.List;
import javax.ejb.Local;
Search WWH ::

Custom Search