Java Reference
In-Depth Information
inject the EJB home object. Although it is possible to inject as many session beans as you
want in this business delegate, the best practice is to have one EJB per business delegate.
Listing 4-2.
public class UnderWritingBusinessDelegate {
private UnderwritingHome underWritingHome;
public void createPolicy(PolicyFormBean policyBean) {
try {
Underwriting bean = this.underWritingHome.create();
policyBean.getFirstName(), policyBean.getAge());
} catch (RemoteException e) {
throw new RuntimeException(e);
} catch (CreateException e) {
throw new RuntimeException(e);
public UnderwritingHome getUnderWritingHome() {
return underWritingHome;
public void setUnderWritingHome(UnderwritingHome underWritingHome) {
this.underWritingHome = underWritingHome;
The service locator can be turned on by configuration, as shown in Listing 4-3. Appli-
cations should use a single instance of a JndiObjectFactoryBean per JNDI object.
Listing 4-3. insurance-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xsi:schemaLocation=" ">
Search WWH ::

Custom Search