ibator 插件 abator配置详解(ibatis自动生成实体类)

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目录下开始

    <javaModelGenerator targetPackage="com.mye.entity.interview" targetProject="hibernateUtil" />       //targetPackage:是实体类存放的路径.
    <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 tableName="nrel_air_sealing"></table>  就这样只写表名也可以.有些说要加上schema和catalog

        <table schema="bim_web_extwall" tableName="bim_web_extwall" catalog="housedetails1"></table> //table中有个了项<columnOverride column="???" property="???" /> 可以先不用配置,删除就可以了      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>

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值