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" >
<generatorConfiguration >
<classPathEntry location="D:/lib/postgresql-9.4-1201-jdbc41.jar" />
  <context id="MysqlContext" targetRuntime="MyBatis3"  defaultModelType="flat" >
  <property name="beginningDelimiter" value="`"/>
    <property name="endingDelimiter" value="`"/>
    
    <commentGenerator>
       <property name="suppressDate" value="true"/>
    </commentGenerator>
    
    
    <jdbcConnection driverClass="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost/demo" userId="postgres" password="postgres" />
    
    <javaModelGenerator targetPackage="gxfw.service.client" targetProject="gxfw.service" >
      <property name="enableSubPackages" value="true" />
      <property name="trimStrings" value="true" />
    </javaModelGenerator>
    <sqlMapGenerator targetPackage="gxfw.service.client" targetProject="gxfw.service" >
    <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>
    
    <javaClientGenerator targetPackage="gxfw.service.client" targetProject="gxfw.service" type="XMLMAPPER" >
    <property name="enableSubPackages" value="true" />
    </javaClientGenerator>
    
   <table tableName="days_user" domainObjectName="User" >
         <generatedKey column="id" sqlStatement="JDBC"/>
    </table>
  </context>

</generatorConfiguration>

如果 使用maven来管理lib,在 pom.xml文件中配置 mybatis-generator-maven-pluginer,就可以不需要使用<classPathEntry location="D:/lib/postgresql-9.4-1201-jdbc41.jar" />了

pom.xml的配置如下

<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
</dependency>




阅读更多
个人分类: Mybatis
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

generatorConfig.xml文件配置

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭