1.安装abator插件, 用自动的就好. url:http://ibatis.apache.org/tools/abator.安装就不用多说了.
2.安装完成后.在新建的框框中就会多了一个.Abator for ibatis Wizard --->abator for ibatis configuration file .
3.建 配置文件.: abatorConfig.xml
在src右键.选择2步中的file 创建.文件名默认的. 建好后里面的选项就都有了 值都是???.
问号就是我们要改的:
<?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="com.mysql.jdbc.Driver" //jdbc的驱动名. 我用mysql
connectionURL="jdbc:mysql://127.0.0.1:3306/housedetails1" //数据库的连接字符串.
userId="root" //用户名
password="mysql"> //密码
<classPathEntry location="mysql-connector-java-5.0.8-bin.jar" /> //mysql的连接驱动包.我放在项目的lib下面.只写包名就可以了. 否则要写文件全路径.d://java/mysql.jar.
</jdbcConnection>
//targetProject :
目标源文件夹位置 写项目名 ,可以不是当前的项目名.只写项目名默认从src目录下开始
<sqlMapGenerator targetPackage="com.mye.sqlmap.interview" targetProject="hibernateUtil" /> //targetPackage:是sqlmap xml文件存放的路径.
<daoGenerator targetPackage="com.mye.dao.interview" targetProject="hibernateUtil/src" type="IBATIS" /> //targetPackage:是dao存放的路径. type:一般写spring.
type:如果写"SPRING" 生成的daoimpl 继承的是SqlMapClientDaoSupport.是
org.springframework.orm.ibatis.support.SqlMapClientDaoSupport
如果写"IBATIS"生成的daoimpl类继承的是SqlMapDaoTemplate. 是com.ibatis.dao.client.template.SqlMapDaoTemplate
如果是GENERIC-CI 生成的daoimpl 没有继承.是com.ibatis.sqlmap.client.SqlMapClient .
<table schema="bim_web_extwall" tableName="bim_web_extwall" catalog="housedetails1"></table> //table中有个了项<columnOverride column="???" property="???" /> 可以先不用配置,删除就可以了 table中schema 写表名.catalog写数据库名称我试过 <table tableName="nrel_air_sealing"></table> 就这样只写表名也可以.有些说要加上schema和catalog
<table schema="bim_web_construction" tableName="bim_web_construction"></table>
<table schema="bim_web_extwall_sub" tableName="bim_web_extwall_sub" catalog="housedetails1"></table>
<table schema="bim_web_door" tableName="bim_web_door" ></table>
<table schema="bim_web_roof" tableName="bim_web_roof" catalog="housedetails1"></table>
<table schema="bim_web_window" tableName="bim_web_window" catalog="housedetails1"></table>
</abatorContext>
</abatorConfiguration>