abator用法

前几天看到家里内控项目组开发的时候在用abator,所以回来研究了一下

学东西嘛,要保持着三个问题, 什么东西? 做什么的? 怎样用?

下面就说一下学的过程:
1.首先,要把这个abator插件下载到myeclipse中,方法: 点击myeclipse工具栏中的help -->
software updates -->find and install-->search for new features to install -->
new remote site --> name = abator --> url = http://ibatis.apache.org/tools/abator
-->finish  下载后,自动安装即可!
2.abator插件安装成功后会在新建中看到,右键点击src新建会在abator for iBatis wizards文件夹下看

到一个前面显示黑色星星的东西 abator for iBatis configuration File,点击后会建一个

abatorConfig.xml文件,配置完如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS

Configuration 1.0//EN"
  "http://ibatis.apache.org/dtd/abator-config_1_0.dtd">

<abatorConfiguration>
  <abatorContext>    <!-- TODO: Add Database Connection Information -->
    <jdbcConnection driverClass="com.mysql.jdbc.Driver"
        connectionURL="jdbc:mysql://localhost:3306/root"
        userId="root"
        password="root">
      <classPathEntry location="D:\workSpace\newSpring\WebRoot\WEB-INF\lib\mysql-connector

-java-5.0.4-bin.jar" />
    </jdbcConnection>

    <javaModelGenerator targetPackage="edu.ccut.userManager.domain"

targetProject="newSpring/src" />
    <sqlMapGenerator targetPackage="edu.ccut.userManager.persistence.ibatisDao.sql"

targetProject="newSpring/src" />
    <daoGenerator type="spring" targetPackage="edu.ccut.userManager.persistence.ibatisDao"

targetProject="newSpring/src" />

    <table schema="sunjian" tableName="users">
      <columnOverride column="id" property="userid" />
      <columnOverride column="username" property="username" />
      <columnOverride column="password" property="password" />
    </table>
  </abatorContext>
</abatorConfiguration>
3.配置完毕 --> 右键点击abatorConfig.xml文件,点击generate iBatis artfacts就会在相应的配置目

录下生成如下文件
/newSpring/src/edu/ccut/userManager/domain/Users.java
/newSpring/src/edu/ccut/userManager/domain/UsersExample.java
/newSpring/src/edu/ccut/userManager/persistence/ibatisDao/sql/users_SqlMap.xml
/newSpring/src/edu/ccut/userManager/persistence/ibatisDao/UsersDAO.java
/newSpring/src/edu/ccut/userManager/persistence/ibatisDao/UsersDAOImpl.java


程序报这个错:
Could not find SQL statement to include with refid

'users.abatorgenerated_Example_Where_Clause'
解决:在sql-map-config.xml中 <settings cacheModelsEnabled="true" enhancementEnabled="true"

useStatementNamespaces="true" />
在这里面加了一个useStatementNamespaces="true" 属性

你可能感兴趣的:(apache,sql,xml,MyEclipse,ibatis)