Java Reference
In-Depth Information
return policyDetailDao;
public void setPolicyDetailDao(PolicyDetailDao policyDetailDao) {
this.policyDetailDao = policyDetailDao;
Note that the session facade invokes the application service, which in turn calls the
DAO method. As a result, the DAO method automatically comes into the same transac-
tional scope as the session bean method. So, there is no need for any programmatic
transaction handling in the DAO.
The JdbcDaoSupport object needs a data source to connect to and execute the SQL
query. The data source object is generally registered in the application server's JNDI. The
Spring service locator (explained in Chapter 4) will be used to look up the data source
from the JNDI and inject it into the JdbcDaoSupport object.
Finally, everything needs to be wired up by the configuration in the Spring applica-
tion context associated with the stateless session bean, as shown in Listing 5-6. I am
showing the application service and DAO in the same configuration so that you can
understand and visualize the coupling between the two. However, for modularity, it is
advised that you put them in separate configuration files.
Listing 5-6. Underwriting-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xsi:schemaLocation="" >
<bean id="uwrApplicationService"
class=" å
<property name="policyDetailDao" ref="policyDetailDao"/>
<bean id="policyDetailDao"
<property name="dataSource" ref="datasource"/>
Search WWH ::

Custom Search