Java Reference
In-Depth Information
List catalogEntry = em.createQuery("SELECT c from Catalog c
where c.catalogId=:catalogId")
.setParameter("catalogId", catalogId).
if (!catalogEntry.isEmpty()) {
for (Iterator iter = catalogEntry.iterator(); iter.
hasNext();) {
catalog = (Catalog);
return catalog;
public void persist(String catalogId, String journal, String
String edition, String title, String author) {
Catalog catalog = new Catalog(catalogId, journal,
publisher, edition, title, author);
In the remote business interface, specify the method signatures of the methods
defined in the session bean. The remote component interface is listed below:
package model;
import javax.ejb.Remote;
public interface SessionEJBFaƧade {
Catalog validate(String catalogId);
void persist(String catalogId, String journal, String
publisher,String edition, String title, String author);
Creating a servlet client
Next, we create a servlet client that is invoked from the input form using an Ajax
request. The servlet does not differentiate between an Ajax request and a regular
HTTP request. It is the Java Script in the browser that implements the Ajax. The
servlet is the client to the session bean and invokes session bean methods to validate
a catalog id specified in the input form, and persist a Catalog entity instance
constructed from the input form field values if a catalog id is valid.
Search WWH ::

Custom Search