本人用命令在测试的时候.. 出现下面的错误
C:\Users\xa>java -jar E:\mybatis-generator-core-1.3.1.jar -configfile D:\Workspaces\MyEclipse10\risenetba\src\generator.xml -overwrite
Table configuration with catalog null, schema orclba, and table zwdt_zidian did not resolve to any tables
MyBatis Generator finshed successfully, there were warninigs.
下面是generator.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- classPathEntry:数据库的JDBC驱动的jar包地址 -->
<classPathEntry
location="D:\Workspaces\MyEclipse10\risenetba\defaultroot\WEB-INF\lib\ojdbc14.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
</commentGenerator>
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@xx.xx.x.xxx:1521:xx" userId="xx"
password="1">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetProject:自动生成代码的位置 -->
<javaModelGenerator targetPackage="xgw.model"
targetProject="D:\Workspaces\MyEclipse10\risenetba\src">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="xgw.sqlmap"
targetProject="D:\Workspaces\MyEclipse10\risenetba\src">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER"
targetPackage="xgw.mapping" targetProject="D:\Workspaces\MyEclipse10\risenetba\src">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<table schema="xx" tableName="zwdt_zidian" domainObjectName="zidian"
enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true" >
</table>
</context>
</generatorConfiguration>
后面发现去掉table中的schema属性就可以了..
经测试,如果数据库用的是Oracle,SqlServer需要去掉schema属性,MySQL则不需要去掉