Java Reference
In-Depth Information
L ISTING 12.7
Continued
public QuotePk(int pk) {
id = new Integer(pk);
}
public boolean equals(Object obj) {
if (obj instanceof QuotePk) {
return id.equals(((QuotePk)obj).id);
}
else {
return false;
}
}
public int hashCode() {
return id.hashCode();
}
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
}
It is important to note that the attributes contained in the primary key class must be a subset of
the container-managed fields when using container-managed persistence. This enables the con-
tainer to match up the proper attributes from the bean class to those in the primary key class.
Bean Class
This EJB's bean class contains the business logic of the entity bean. It has similar rules to the
bean class for a session bean, just many more of them. It implements all of the business meth-
ods from the remote interface. It has methods that match each of the methods in the home
interface. There is also a group of callback methods that are used by the container to manage
the bean.
Search WWH ::




Custom Search