Java Reference
In-Depth Information
import javax.ejb.FinderException;
import java.rmi.RemoteException;
public interface QuoteHome extends EJBHome
public Quote create(Integer id) throws RemoteException, CreateException;
public Quote create(Integer id, String name)
throws RemoteException, CreateException;
public Quote findByPrimaryKey(Integer pk)
throws RemoteException, FinderException;
public Collection findByName(String name)
throws RemoteException, FinderException;
Primary Key Class
The primary key class is specific to entity beans. Every entity bean must have a primary key
class specified in the deployment descriptor. This is the simplest class involved when writing
an entity bean. Many times it is as simple as using the java.lang.Integer class as the pri-
mary key.
The primary key class contains attributes to uniquely identify one bean from another of the
same type. It is the primary key for the entry in the database. There are few specifications for
the primary key class. It must be serializable and have a public default constructor. It is also
recommended that the class properly implement the hashCode() and equals(Object)() meth-
ods. This is to simplify the management of primary keys by both the client and the container.
It is possible to use preexisting classes like java.lang.Integer , however you will develop a
simple primary key class for the Quote Bean. Its source code is in Listing 12.7.
public class QuotePk implements Serializable {
public Integer id = null;
public QuotePk() {
Search WWH ::

Custom Search