ibatis 自动生成map,bean,dao

1.下载 AbatorForEclipse1.1.0

地址:http://download.csdn.net/detail/fym548/9426877

点击Archive按钮选择下载的,然后重启MyEclipse

新建一个项目,右键新增

会生成一个 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 >
    <jdbcConnection driverClass="???" connectionURL="???" userId="???" password="???" >
      <classPathEntry location="???" />
    </jdbcConnection>
    <javaModelGenerator targetPackage="???" targetProject="???" />
    <sqlMapGenerator targetPackage="???" targetProject="???" />
    <daoGenerator targetPackage="???" targetProject="???" type="GENERIC-CI" />
    <table schema="" tableName="???" >
    </table>
  </abatorContext>
</abatorConfiguration>

特别要注意版本要下对  不然自动生成不了  

driverClass:驱动名称
connectionURL:数据库链接地址
userId:数据库用户名

password:数据库用户密码
classPathEntry:驱动包路径,填写绝对路径

javaModelGenerator:模型层
sqlMapGenerator:ibatis  map层
daoGenerator:dao 层
table:表
schema如果在connectionURL里面填写了,这里就不要写,如果没这里要写
tableName:表名

填写完后右键选择这个文件,选择


就可以自动生成了

原文地址:https://www.cnblogs.com/fuyuanming/p/5180264.html