您的位置:首页 > 其它

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

2016-04-26 17:26 645 查看
 

 

问题:

Tableconfiguration with catalog null, schema orcl, and table ORDERS did not resolveto any tables

MyBatisGenerator finished successfully, there were warnings.

 

 

 原因:

1. jdbc:oracle:thin:@11.22.22.22:1521:orcl

oracle配置的是":"

 

2. <jdbcConnectiondriverClass="com.mysql.jdbc.Driver"connectionURL="jdbc:Mysql://localhost:3306/DB?characterEncoding=utf8"   />

 

3.     <tabletableName="orders"domainObjectName="Orders"
         enableInsert="true"
         enableCountByExample="false"enableUpdateByExample="false"enableDeleteByExample="false"
            enableSelectByExample="false"selectByExampleQueryId="false">
 
      </table>

 

表名配置错误

 

 

 

问题: 去掉Example,没用看着也乱

 

 

 

<!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<table tableName="orders" domainObjectName="Orders"
enableInsert="true"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>


 

 

 

 

正常配置

  

<?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 location="C:\DingSai\Work\lib_source\ojdbc14.jar" />
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressAllComments" value="true" />
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
</commentGenerator>
<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@10.199.xx.xx:1521:orcl" userId="xx"
password="xx">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>

<!-- targetProject:自动生成代码的位置 -->
<javaModelGenerator targetPackage="com.soft.model"
targetProject="c:\src">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="true" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>

<!--生成SQLMAP文件 -->
<sqlMapGenerator targetPackage="com.soft.model"
targetProject="c:\src">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!--生成Dao文件 可以配置 type="XMLMAPPER"生成xml的dao实现
ANNOTATEDMAPPER	生成的对象是 MyBatis 3.x 映射器基础结构的 Java接口。 这些接口将会基于注解和 MyBatis 3.x SqlProviders。不会有XML文件生成。(注:就是纯接口使用注解的形式,不会有XML文件)
ANNOTATEDMAPPER 依赖 MyBatis 3.0.4 或更高版本。;
MIXEDMAPPER	生成的对象是 MyBatis 3.x 映射器基础结构的 Java接口。 这些接口将基于注解和XML的混合形式。 注解将会用在简单注解可以实现的地方。 此客户端不会生成SqlProvider,所有复杂的动态SQL都会生成在XML中。
The MIXEDMAPPER 依赖 MyBatis 3.0.4 或更高版本。;
XMLMAPPER	生成的对象是 MyBatis 3.x 映射器基础结构的 Java接口。 这些接口将会依赖于生成的XML文件。;
-->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.soft.model" targetProject="c:\src">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>

<!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<table tableName="orders" domainObjectName="Orders"
enableInsert="true"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
</context>

</generatorConfiguration>


 

 

I.执行命令

 

java -jar C:\DingSai\Work\workspace8.5\apiportal\lib\mybatis-generator-core-1.3.2.jar -configfile C:\DingSai\Work\study\dubbo_project\edu-service-user\src\main\java\generatorConfig.xml -overwrite


 

 

 全部资源下载地址:http://download.csdn.net/detail/dingsai88/9503305

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: