Mybatis代码生成器 xml配置文件 连接SQL SERVER 2005

<?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:/test2/sqljdbc4.jar"/>

    <context id="DefualtJava5" targetRuntime="MyBatis3">

        <property name="suppressTypeWarnings" value="true"/>

        <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>
        <plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin"/>
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
        <plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin">
            <property name="searchString" value="Example$"/>
            <property name="replaceString" value="Critera"/>
        </plugin>
        <plugin type="org.mybatis.generator.plugins.MapperConfigPlugin">
           <property name="targetPackage" value="config"/>
            <property name="targetProject" value="resource"/>
            </plugin>
        <commentGenerator>
            <property name="suppressAllComments" value="true"/>
        </commentGenerator>


        <jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver"  
            connectionURL="jdbc:sqlserver://localhost:1433;DatabaseName=TestJDBC" userId="sa" password="vip">  
        </jdbcConnection> 
        
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
        
        <javaModelGenerator targetPackage="model" targetProject="c:/test2/">
          <property name="enableSubPackages" value="true" />
          <property name="trimStrings" value="true" />
        </javaModelGenerator>

        <sqlMapGenerator targetPackage="model.sqlMapper"  targetProject="c:/test2/">
          <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <javaClientGenerator type="XMLMAPPER" targetPackage="mapper" targetProject="c:/test2/">
          <property name="enableSubPackages" value="true" />
        </javaClientGenerator>
    
        <!--
         -->
        <table tableName="aws"/>
    </context>
</generatorConfiguration>


<!--
使用cmd,将目录定在本文件夹,然后执行以下命令启动:
java -jar mybatis-generator-core-1.3.1.jar -configfile  test.xml -overwrite

-->

 

posted @ 2014-04-01 22:59  无忧之路  阅读(3551)  评论(0编辑  收藏  举报
无忧之路