Java Reference
In-Depth Information
Procedure access objects are similar to data access objects. They wrap the execution
of a single stored procedure. Listing 5-18 shows the PAO to save information about a new
Listing 5-18.
public class SaveNewLeadPao extends StoredProcedure{
public SaveNewLeadPao(){
declareParameter(new SqlOutParameter("pLeadId", Types.INTEGER));
declareParameter(new SqlParameter("pName", Types.VARCHAR));
declareParameter(new SqlParameter("pCountryCd", Types.VARCHAR));
public Map execute(Map inParamMap){
return super.execute(inParamMap);
The declareParameter method needs to be called in the exact order in which the
parameters are declared in the stored procedure. The stored procedure abstraction sup-
ports input as well as output variables. The procedure execute is triggered by the execute
method, which accepts a Map argument. This Map object contains the input values to be
passed to the stored procedure. The keys of this Map are the same as the stored procedure
input parameter names. The execute method in the SaveNewLeadPao subclass delegates to
the superclass execute method. The execute method returns a Map as output. The output
map contains results returned from the database. The keys of this map are the same
declared output parameter names of the stored procedure.
The application service is the client of the PAO. Everything can be configured in the
Spring configuration as in Listing 5-19.
Listing 5-19. underwriting-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<bean id="uwrApplicationService"
class=" å
Search WWH ::

Custom Search