TechnoBuzz

A Techno Blog, mainly about Java

DAOs

DAOs (Data Access Objects) make use of the Template Method whereby there are several steps required, but you are only concern yourself with some of the steps. You encapsulate the individual steps we dont know how to perform as abstract methods, and provide an abstract superclass that invokes them .

I will have a Concrete subclasses of this abstract superclass implement the abstract methods to perform the individual steps.

For example, I have this method FindAllResources which returns a List which does a SQL Select operation.  All I have to be concerned with here is creating the select string and parameters and send it off to the SQL JDBC task.

List filterParms =

String statement ="SELECT …."

return this.findZeroOrMoreRecords(statement, filterParms.toArray());

I also have to copy what comes back from the database into a bean with the method:

Object processResultSetRow(ResultSetRow row)

Advertisements

June 20, 2005 - Posted by | IoC

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: