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

来源:互联网 发布:互助系统源码带排单币 编辑:程序博客网 时间:2024/05/29 11:45

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>

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 酷狗国外听不了怎么办 酷狗音乐换手机怎么办 有优势卵泡不排卵怎么办 卵泡30mm不破怎么办 成熟的卵泡不破怎么办 卵泡大了不破怎么办 卵泡突然不长了怎么办 想怀孕卵泡不长怎么办 吉吉影音下载慢怎么办 辞职后社保断了怎么办 2岁泡泡糖咽下去怎么办 我在拼多多开团怎么办 养了一条鱼死了怎么办 鱼缸的鱼尾巴烂怎么办 捡到玉佛吊坠该怎么办 晚上睡不踏实多梦易醒怎么办 红米3s蓝屏怎么办 吃饭没给钱跑了怎么办 刚出生的宝宝红屁屁怎么办 刚出生的宝宝红屁股怎么办 眼镜配高了25度怎么办 广州摇号中签后怎么办 深圳摇号中签后怎么办 皮肤被紫外线晒伤怎么办 脸被太阳晒过敏怎么办 星际2买了的怎么办 脸被风吹红了怎么办 天谕背包满了怎么办 剑灵没用的武器怎么办 人老实心太善良怎么办 雷蛇鼠标滚轮响怎么办 唱歌唱的嗓子疼怎么办 额头又高又凸怎么办 40多岁满头白发怎么办 被梅毒的针扎了怎么办 小腿上有肌肉块怎么办 血沉方程k值高怎么办 婚后父母给的钱怎么办 如果高考志愿没被录取怎么办 买到二手车退档怎么办 驾考过期怎么办退档