JingDAO Tutorial: Resolvers

JingDAO uses the idea of URI (universal resource identifier) Resolvers to determine how to load DAO resources. A set of default resolver schemes is included, but you can easily add more.

Default Resolvers

The following resolver schemes are included by default:

Scheme Name Description Example
class Used to load a class from the default ClassLoader. class://java.util.Integer

parent Used to retrieve a value from the parent context. Only used in context <entry> elements parent://homeDir
jndi Used to lookup JNDI objects. Defaults to the default InitialContext . jndi://myDataSource


Resolver Configuration

The following shows how to configure a new resolver. In this example, we are looking up a remote object (simpleDao) from a local server using AltRMI.

<?xml version="1.0" encoding="ISO-8859-1"?>
    <resolvers id="resolver">
      <resolver scheme="jndi" class="org.jadetower.resolver.impl.JndiResolver">
         <parameter name="java.naming.factory.initial"
         <parameter name="java.naming.provider.url"

    <manager id="default">
        <dao name="simple-local" uri="class://org.jadetower.dao.test.daos.impl.HelloWorldDaoImpl" />
        <dao name="simple-remote" uri="jndi://simpleDao"/>

You can create your own Resolver by implementing the org.jadetower.resolver.Resolver interface. Examples could include a JMS, SOAP, or Database resolver. To use these custom resolvers, simply include them in your classpath and then specify the resolver class in the class attribute.

Resolvers can be used in either context configuration or in defining the DAO's themselves. The most common uses are to use a JNDI resolver to retrieve a database DataSource object which is placed in the context or to access remote DAO objects such as EJB's.