Specifying a CMP Entity Bean
Specifying a CMP Entity bean is identical to specifying a BMP Entity bean; it consists of defining the local-home interface and the local interface. This makes sense; after all, to the user of the bean, it should not matter whether the bean is implemented internally using CMP or BMP.
The Local-Home Interface
For completeness, Listing 7.2 is the local-home interface of the Job bean.
Listing 7.2. JobLocalHome Interface
1: package data;
2:
3: import java.rmi.*;
4: import java.util.*;
5: import javax.ejb.*;
6:
7: public interface JobLocalHome extends EJBLocalHome
8: {
9: JobLocal create (String ref, String customer) throws CreateException;
10: JobLocal findByPrimaryKey(JobPK key) throws FinderException;
11: Collection findByCustomer(String customer) throws FinderException;
12: Collection findByLocation(String location) throws FinderException;
13: void deleteByCustomer(String customer);
14: }
The Local Interface
Listing 7.3 shows the local interface for the Job bean; it, too, is unchanged from the BMP version.
Listing 7.3. JobLocal Interface
1: package data;
2:
3: import java.rmi.*;
4: import javax.ejb.*;
5: import java.util.*;
6:
7: public interface JobLocal extends EJBLocalObject
8: {
9: String getRef();
10: String getCustomer();
11: CustomerLocal getCustomerObj(); // derived
12:
13: void setDescription(String description);
14: String getDescription();
15:
16: void setLocation(LocationLocal location);
17: LocationLocal getLocation();
18:
19: Collection getSkills();
20: void setSkills(Collection skills);
21: }
..................Content has been hidden....................
You can't read the all page of ebook, please click
here login for view all page.