<!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>