HTML and CSS Reference
In-Depth Information
Book
JPA entity class has the following attributes:
id
: Marked as a primary key for the entity using @Id annotation. It is an auto-generated
attribute.
•
ISBN
: Validated to be not null. ISBN is validated to be between 10 and 20 characters.
•
title
: Validated to be not null. Book title is validated be between 5 and 128 characters.
•
author
: Validated to be not null. Book author is validated to be between 3 and 128 characters.
•
publisher
: Validated to be not null. Book publisher is validated to be between 3 and 64
characters.
•
lang
: Represents the topic language and it is validated to be not null. Book language is
validated to be between 3 and 64 characters.
•
content
: Represents the topic content and it is marked as a Lob (Large Object).
•
bookRequestList
: Represents the associated requests of the topic; its cascade type is set
to “All”, which means that all of the operations (merge, persist, remove, refresh) will
be cascaded.
•
■
it is important to note that all of the following Jpa entities will be used as CDi beans in the application Facelets
pages: for more information, check the “Composing page templates” section.
Note
Now, let's move to the second EJB Manager (
MegaUserManager
) EJB. Listing 13-7 shows the EJB Local interface of
MegaUserManager
EJB.
Listing 13-7.
MegaUserManager EJB Local Interface
package com.jsfprohtml5.megaapp.service;
import com.jsfprohtml5.megaapp.model.MegaUser;
import com.jsfprohtml5.megaapp.service.exception.UserAlreadyExists;
import com.jsfprohtml5.megaapp.service.exception.UserNotFound;
import java.util.List;
import javax.ejb.Local;
@Local
public interface MegaUserManagerLocal {
public MegaUser getMegaUser(String userID) throws UserNotFound;
public List<MegaUser> retrieveMegaUsers();
public MegaUser registerMegaUser(MegaUser user) throws UserAlreadyExists;
public void removeMegaUser(String userID) throws UserNotFound;
}
Listing 13-8 shows the
MegaUserManager
EJB class implementation.
