Frames No Frames

Tasks After Running Abator

After you run Abator, you will need to create or modify other iBATIS configuration artifacts. The main tasks are as follows:

Each task is described in detail below.

Updating the SqlMapConfig.xml File

iBATIS uses an XML file, commonly named SqlMapConfig.xml, to specify information for a database connection, a transaction management scheme, and SQL map XML files that will be used in an iBATIS session. Abator cannot create this file for you because Abator knows nothing about your execution environment. However, some of the items in this file relate directly to Abator generated items. Please refer to the standard iBATIS data mapper developer guide for details about the different configuration options.

Abator specific needs in the configuration file are as follows:

For example, suppose that Abator has generated an SQL Map XML file called MyTable_SqlMap.xml, and that the file has been placed in the test.xml package of your project. The SqlMapConfig.xml file should have these entries:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE sqlMapConfig
    PUBLIC "-// SQL Map Config 2.0//EN"

    <!-- Statement namespaces are required for Abator -->
    <settings useStatementNamespaces="true" />

    <!-- Setup the transaction manager and data source that are
         appropriate for your environment
    <transactionManager type="...">
      <dataSource type="...">

    <!-- SQL Map XML files should be listed here -->
    <sqlMap resource="test/xml/MyTable_SqlMap.xml" />


If there is more than one SQL Map XML file (as is quite common), then the files can be listed in any order with repeated <sqlMap> elements after the <transactionManager> element.

Updating the dao.xml File

Note that this step is only required if you generated DAOs for the iBATIS DAO framework.

The iBATIS DAO framework is configured by an xml file commonly called dao.xml. The iBATIS DAO framework uses this file to control the database connection information for DAOs, and also to list the DAO implementation classes and DAO interfaces. In this file you should specify the path to your SqlMapConfig.xml file, and all the Abator generated DAO interfaces and implementation classes.

For example, suppose that Abator has generated a DAO interface called MyTableDAO and a implementation class called MyTableDAOImpl, and that the files have been placed in the test.dao package of your project. The dao.xml file should have these entries:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE daoConfig
   PUBLIC "-// DAO Configuration 2.0//EN"

      <transactionManager type="SQLMAP">
        <property name="SqlMapConfigResource"

      <!-- DAO interfaces and implementations should be listed here -->
      <dao interface="test.dao.MyTableDAO"
           implementation="test.dao.MyTableDAOImpl" />