Exercise 5.3: The Local Component Interfaces
The example program in Exercise 5.3 explores the use of local interfaces. The Cabin entity bean you created in Exercise 4.1 will be expanded to provide a local interface for use in the TravelAgent stateless session bean. This exercise also describes how to modify your EJB deployment descriptors to enable local interfaces.
Start Up JBoss
If you already have JBoss running, there is no reason to restart it. Otherwise, start it up as instructed in the JBoss Installation and Configuration chapter.
Initialize the Database
The database should contain the 100 rows created by a successful
execution of the test programs from Exercise
4.1.
Build and Deploy the Example Programs
In the ex05_3 directory, build and deploy the
examples as you did for Exercise 5.1.
Examine the JBoss-Specific Files
JBoss has a minor restriction. It requires that you use
<ejb-link> when you want your bean to
reference a local bean through an
<ejb-local-ref> tag.
ejb-jar.xml
<ejb-jar> <enterprise-beans> ... <session> <ejb-name>TravelAgentEJB</ejb-name> <home>com.titan.travelagent.TravelAgentHomeRemote</home> <remote>com.titan.travelagent.TravelAgentRemote</remote> <ejb-class>com.titan.travelagent.TravelAgentBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-local-ref> <ejb-ref-name>ejb/CabinHomeLocal</ejb-ref-name> <ejb-ref-type>Entity</ejb-ref-type> <local-home>com.titan.cabin.CabinHomeLocal</local-home> <local>com.titan.cabin.CabinLocal</local> ...