MyBatis Generator generatorConfig.xml configuration details

  1. <?xml version="1.0" encoding="UTF-8" ?>  
  2. <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >  
  3. <generatorConfiguration>  
  4.     <!-- Import configuration file -->  
  5.     <properties resource="init.properties"/>  
  6.       
  7.     <!-- Specify the data connection driver jar address -->  
  8.     <classPathEntry location="${classPath}" />  
  9.       
  10.     <!-- One database one context -->  
  11.     <context id="infoGuardian">  
  12.         <!-- comment -->  
  13.         <commentGenerator >  
  14.             <property name="suppressAllComments" value="false"/><!-- whether to uncomment -->  
  15.             <property name="suppressDate" value="true" /> <!-- Whether to generate a timestamp for comment generation-->  
  16.         </commentGenerator>  
  17.           
  18.         <!-- jdbc connection -->  
  19.         <jdbcConnection driverClass="${jdbc_driver}"  
  20.             connectionURL="${jdbc_url}" userId="${jdbc_user}"  
  21.             password="${jdbc_password}" />  
  22.           
  23.         <!-- type conversion -->  
  24.         <javaTypeResolver>  
  25.             <!-- Whether to use bigDecimal, false can automatically convert the following types (Long, Integer, Short, etc.) -->  
  26.             <property name="forceBigDecimals" value="false"/>  
  27.         </javaTypeResolver>  
  28.           
  29.         <!-- Generate entity class address -->    
  30.         <javaModelGenerator targetPackage="com.oop.eksp.user.model"  
  31.             targetProject="${project}" >  
  32.             <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
  33.             <property name="enableSubPackages" value="false"/>  
  34.             <!-- Whether to make a trim call when setting a field of type string -->  
  35.             <property name="trimStrings" value="true"/>  
  36.         </javaModelGenerator>  
  37.           
  38.         <!-- Generate mapxml file -->  
  39.         <sqlMapGenerator targetPackage="com.oop.eksp.user.data"  
  40.             targetProject="${project}" >  
  41.             <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
  42.             <property name="enableSubPackages" value="false" />  
  43.         </sqlMapGenerator>  
  44.           
  45.         <!-- Generate mapxml corresponding client, which is interface dao -->      
  46.         <javaClientGenerator targetPackage="com.oop.eksp.user.data"  
  47.             targetProject="${project}" type="XMLMAPPER" >  
  48.             <!-- Whether to add a new layer of schema under the current path, eg: false path com.oop.eksp.user.model, true: com.oop.eksp.user.model.[schemaName] -->  
  49.             <property name="enableSubPackages" value="false" />  
  50.         </javaClientGenerator>  
  51.           
  52.         <!-- Configuration table information -->      
  53.         <table schema="${jdbc_user}" tableName="s_user"  
  54.             domainObjectName="UserEntity" enableCountByExample="false"  
  55.             enableDeleteByExample="false" enableSelectByExample="false"  
  56.             enableUpdateByExample="false">  
  57.             <!-- schema is the database name tableName is the corresponding database table domainObjectName is the entity class to be generated enable*ByExample   
  58.                 Whether to generate example class -->  
  59.               
  60.             <!-- Ignore columns, do not generate bean fields -->  
  61.             <ignoreColumn column="FRED" />  
  62.             <!-- Specify the java data type of the column -->  
  63.             <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />  
  64.         </table>  
  65.   
  66.     </context>  
  67. </generatorConfiguration>  
  68. Attached to my init.properties
  69. #Mybatis Generator configuration  
  70. project = EKSP  
  71. classPath=E:/workplace/EKSP/WebContent/WEB-INF/lib/ojdbc14.jar  
  72. jdbc_driver = oracle.jdbc.driver.OracleDriver  
  73. jdbc_url=jdbc:oracle:thin:@127.0.0.1:1521:orcl  
  74. jdbc_user=INFOGUARDIAN  
  75. jdbc_password=info_idap132  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325455071&siteId=291194637