LJ Archive

Listing 3. Defining a Home Interface

package il.co.lerner.book;

import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import java.rmi.RemoteException;
import java.util.Collection;

/* This class defines the home
interface for our Book entity bean. */

public interface BookHome extends EJBHome
{
    /* Create a new instance of Book */
    public Book create(int newId, String newTitle,
             String newAuthor, String
                       newPublisher,
             double newUsDollarPrice)
   throws RemoteException, CreateException;

    /* Find a Book with the specified ID. The EJB
    container implements this method for us
    automatically. */

    public Book findByPrimaryKey (int id)
   throws RemoteException, FinderException;

    /* Return a Collection of books that matches an
    author name. This method is implemented
    automatically by the EJB container. */

    public Collection findByAuthor (String authorName)
   throws RemoteException, FinderException;

    /* Return all of the Book objects in the database */
    public Collection findAll()
        throws RemoteException, FinderException;
}
LJ Archive