SpringtoolSuite添加mybatis generator插件

Help--Install new software--add

在弹出框中填入generator,地址是http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite/

然后选中搜索出的结果,下一步直到安装结束。

在src/main/resources下添加 名为generatorConfig.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">  
  <!-- org.mybatis.generator:mybatis-generator-maven-plugin:1.3.1:generate -->
<generatorConfiguration>  

<!-- 这里填个数据库连接器的jar包位置-->
    <classPathEntry location="E:\jar\maven-repo\mysql\mysql-connector-java\5.1.27\mysql-connector-java-5.1.27.jar" />  
    <context id="DB2Tables" targetRuntime="MyBatis3">  
  
        <commentGenerator>  
            <property name="suppressDate" value="true" />  
        </commentGenerator>  
  
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"  
            connectionURL="jdbc:mysql://IP:3307/custmis?useUnicode=true&characterEncoding=UTF-8" userId="admin" password="liantong">  
        </jdbcConnection>  
  
        <javaTypeResolver>  
            <property name="forceBigDecimals" value="false" />  
        </javaTypeResolver>  
  
        <javaModelGenerator targetPackage="com.winksi.model"  
            targetProject="HistoryDataArrange">  
            <property name="enableSubPackages" value="true" />  
            <property name="trimStrings" value="true" />  
        </javaModelGenerator>  
  
        <sqlMapGenerator targetPackage="com.winksi.dao"  
            targetProject="HistoryDataArrange">  
            <property name="enableSubPackages" value="true" />  
        </sqlMapGenerator>  
  
        <javaClientGenerator type="XMLMAPPER"  
            targetPackage="com.winksi.dao" targetProject="HistoryDataArrange">  
            <property name="enableSubPackages" value="true" />  
        </javaClientGenerator>  
  
        <table tableName="cust_biz" domainObjectName="CustBiz"></table>
        <table tableName="cust_biz_content" domainObjectName="CustBizContent"></table>
        <table tableName="cust_biz_phone" domainObjectName="CustBizPhone"></table>
        <table tableName="cust_biz_content_area" domainObjectName="CustBizContentArea"></table>
        <table tableName="cust_biz_transfer_data" domainObjectName="CustBizTransferData"></table>
        <table tableName="cust_biz_content_check" domainObjectName="CustBizContentCheck"></table>
        <table tableName="cust_biz_stat" domainObjectName="CustBizStat"></table>
  
    </context>  
</generatorConfiguration>
然后再该配置文件上右键,Generator Mybatis/IBatis Aftifacts,刷新目录,即可看到生成的文件。

有时候会出现如下错误path for project must have only one segment

修改方法是,将targetProject改成项目的工程名,而不是src/main/java或../src/main/java



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值