Name
Procedure Access Object
Goal
Leverage stored procedures in the database by providing a transparent Java interface (Figure B-6).

Participants
- Business tier or presentation tier object
Executes business logic.
- PAO
Provides Java code with access to a database stored procedure.
- Database stored procedure
Implements business logic within a database system.
Interactions
A business or presentation tier object (the client) creates an
instance of a PAO and optionally sets properties. The client calls
the PAO’s execute( ) method. The
PAO then accesses the database and invokes a stored procedure using
the properties passed in by the client. The PAO may perform
transformations of the parameters set by the client to match the
expectations of the stored procedure. After the stored procedure
completes, the client may read additional properties on the PAO to
retrieve the results of the stored procedure.
Notes
A PAO can also be implemented using a method-return syntax, in which all input parameters are passed into a single, possibly static, method call on the PAO object. In this case, return values are provided to the client via a DTO object. Also see the GoF Command pattern.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access