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 <!--生成命令:java -jar mybatis-generator-core-1.3.1.jar -configfile mybatis-generator.xml -overwrite --> 6 <generatorConfiguration> 7 8 <classPathEntry location="D:/generator/ojdbc14.jar" /> 9 <context id="WS_Tables" targetRuntime="MyBatis3"> 10 <commentGenerator> 11 <property name="suppressAllComments" value="true"/> 12 </commentGenerator> 13 14 15 <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.1.110:1521:duwenlei" userId="system" password="du"></jdbcConnection> 16 <javaTypeResolver> 17 <property name="forceBigDecimais" value="false"/> 18 </javaTypeResolver> 19 20 21 <javaModelGenerator targetPackage="sy.model" targetProject="D:/generator/src"> 22 <property name="enableSubPackages" value="true"/> 23 <property name="trimStrings" value="true"/> 24 </javaModelGenerator> 25 26 27 <sqlMapGenerator targetPackage="sy.mapping" targetProject="D:/generator/src"> 28 <property name="enableSubPackages" value="true"/> 29 </sqlMapGenerator> 30 31 32 <javaClientGenerator targetPackage="sy.dao" type="XMLMAPPER" targetProject="D:/generator/src"> 33 <property name="enableSubPackages" value="true"/> 34 </javaClientGenerator> 35 36 37 <table tableName="user_" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> 38 </context> 39 </generatorConfiguration>
注意:所有的targetProject="D:/generator/src",不要包含中文名称,要不然会一堆乱码
需要用到数据库驱动
mybatis-generator-core-1.3.2.jar两个jar文件。