ORCL

 步骤一:

打开Eclipse-help-Install New Software 如下图:



然后一直按照提示做,当Eclipse重启之后:

步骤二:

点击File -New ,如下图:



 步骤三:

abator.xml存放位置

 步骤四:



 步骤五:以下是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 >
    <!--
    driverClass:(jdbc驱动,例如oracle的就是oracle.jdbc.driver.OracleDriver)
    connectionURL:(连接字符串,例如oracle的就是jdbc:oracle:thin:@localhost:1521:orcl)
    userId : (数据库用户名:system ;数据库用户登录密码:password)
    classPathEntry的location:(jdbc驱动jar包的位置,例如E:\test\WebContent\WEB-INF\lib\ojdbc5.jar)
     -->
    <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@localhost:1521:orcl" userId="system" password="password" >
      <classPathEntry location="E:\test\WebContent\WEB-INF\lib\ojdbc5.jar" />
    </jdbcConnection>
    <!--  
    javaModelGenerator:生成的DTO(java model 类)
    targetPackage:目标包的位置,如 com.test.model
    targetProject:目标工程名称,填写配置文件所在的eclipse工程名,如test/src
    -->
    <javaModelGenerator targetPackage="com.test.model" targetProject="test/src" />
    <!--
    sqlMapGenerator:生成的xml sqlmap的相关配置
    targetPackage:目标位置,如 com.test.sqlmap
    targetProject:目标工程名称,填写配置文件所在的eclipse工程名,如test/src
    -->
    <sqlMapGenerator targetPackage="com.test.sqlmap" targetProject="test/src" />
    <!--
    daoGenerator:生成的DAO的相关配置
    type:生成的dao实现的类型,如果你使用spring的话写SPRING,否则写IBATIS
    targetPackage:目标位置,如 com.test.dao
    targetProject:目标工程名称,填写配置文件所在的eclipse工程名,如test/src
    -->
    <!--
    DAO的存放目录, IBATIS DAO在最新版中已经不再更新,可以用spring框架DAO管理代替,或者使用GENERIC-CI不使用框架,直接使用SQL client map
    -->
    <daoGenerator targetPackage="com.test.dao" targetProject="test/src" type="GENERIC-CI" />
    <!--
          配置相关数据库的表
    schema:oracle就是填写数据库的用户名,如use
    tableName:表名,如test
    catalog:数据库名,如orcl
         注释掉<columnOverride column="???" property="???" />,不写columnOverride的话生成所有字段
    -->
    <table schema="use" tableName="test" >
    <!--
    javaType:要转换的数据类型
    jdbcType:表中该字段的类型
    -->
    <columnOverride column="type" property="type" javaType="String" jdbcType="String"/>
    </table>
  </abatorContext>
</abatorConfiguration>

步骤六:

右键点击abtorConfig.xml文件, 选择Generate iBATIS Artifacts



 步骤七:查看生成的内容



 备注:我用的是Eclipse 3.7 ,一开始用Eclipse 4.4.1 或者 Eclipse4.5.2 在操作过程中出现如下错误:

 An error occurred while installing the items
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Install, operand=null --> [R]org.apache.ibatis.abator.core 1.1.0, action=).
Failed to prepare partial IU: [R]org.apache.ibatis.abator.core 1.1.0.

因时间关系,没有来的及查找原因,望有大神可以指点一二。

 QQ:1749599512(方便联系)

猜你喜欢

转载自1749599512.iteye.com/blog/2286440