使用Mybatis Generator 生产 AS400中的数据表对象

第一次使用Mybatis,由于公司核心服务器是AS400,参考了网络各个大大的教程后,发现无法使用Mybatis Generator自动生成AS400中的表对象

参考URL: http://www.cnblogs.com/smileberry/p/4145872.html

生成后会报如下错误

Table configuration with catalog null, schema null, and table ZKC03P did not resolve to any tables

最后通过增加schema解决

具体配置Config如下:

 1 <?xml version="1.0" encoding="UTF-8"?>
 2  <!DOCTYPE generatorConfiguration
 3    PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
 4    "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
 5  <generatorConfiguration>
 6      <!--数据库驱动-->
 7      <classPathEntry    location="jt400-1.0.jar"/>
 8      <context id="DB2Tables"    targetRuntime="MyBatis3">
 9          <commentGenerator>
10              <property name="suppressDate" value="true"/>
11              <property name="suppressAllComments" value="true"/>
12          </commentGenerator>
13          <!--数据库链接地址账号密码-->
14          <!--注:R21AFLBZ是我们库名称-->
15          <jdbcConnection driverClass="com.ibm.as400.access.AS400JDBCDriver" connectionURL="jdbc:as400://172.31.72.37/R21AFLBZ;errors=full;transaction isolation=none;date format=iso" userId="ABC123" password="ABC123">
16          </jdbcConnection>
17          <javaTypeResolver>
18              <property name="forceBigDecimals" value="false"/>
19          </javaTypeResolver>
20          <!--生成Model类存放位置-->
21          <javaModelGenerator targetPackage="pojo" targetProject="src">
22              <property name="enableSubPackages" value="true"/>
23              <property name="trimStrings" value="true"/>
24          </javaModelGenerator>
25          <!--生成映射文件存放位置-->
26          <sqlMapGenerator targetPackage="mapping" targetProject="src">
27              <property name="enableSubPackages" value="true"/>
28          </sqlMapGenerator>
29          <!--生成Dao类存放位置-->
30          <javaClientGenerator type="XMLMAPPER" targetPackage="dao" targetProject="src">
31              <property name="enableSubPackages" value="true"/>
32          </javaClientGenerator>
33          <!--生成对应表及类名  注:重点修改在这里--> 
34          <table schema="R21AFLBZ" tableName="ZKC03P" domainObjectName="ZKC03P" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
35      </context>
36  </generatorConfiguration>

 

执行命令 

java -jar mybatis-generator-core-1.3.5.jar -configfile generatorConfig.xml -overwrite

其他配置参考网上设置即可

 

转载于:https://www.cnblogs.com/magic-forever/p/5881887.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值