JingDAO Overview

JingDAO uses Avalon and PicoContainer to provide a simple yet flexible DAO framework. If you are not familiar with the Data Access Object pattern (or design patterns in general), you should look at the Sun site .

The crux of the pattern is this:

Seperate your access interface from your access implementation

The documents linked above provide a much more in depth discussion of the whys and hows. JingDAO is designed to give you a simple DAO framework for accessing your DAO definitions. It's flexible enough to work in servlets, Avalon containers, or even stand alone applications. It puts no "contracts" on your DAO implementations, so adapting an existing body of code is not difficult. Moreover, you are free to use any persistence framework in your DAO implementations.

Example Use Case

Here's an overview of how you could use JingDAO in a Struts based web application. In Struts, the View and Controller aspects of the MVC design pattern are provided. JingDAO would help provide the glue for your Model implementation:

Jing Use Case

The Struts Action could get the DaoManager from the ServletContext (see the examples for how to do this) and then lookup the needed DAO's. The DAO's themselves define the business logic (like EJB's -- in fact, the implementation could be an EJB). The main advantage of this approach is that:

  • The implementation can be swapped out WITHOUT changing the client code
  • Multiple implementations can be handled at the same time, allowing 'context' switching.

For more details, see the Usage section.