mybatis-generator配置

<?xml version="1.0" encoding="UTF-8" ?>java

<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >mysql

<generatorConfiguration>sql

<!-- 制定mysql的驱动包的路径 千万别放中文路径下 -->mybatis

<classPathEntry location="D:\mysql-connector-java-5.0.8-bin.jar" />spa

<!-- 配置数据源和生成的代码所存放的位置 -->xml

<context id="context1">资源

 

<commentGenerator>get

<!-- 去除自动生成的注释 -->generator

<property name="suppressAllComments" value="true" />it

</commentGenerator>

 

<jdbcConnection driverClass="com.mysql.jdbc.Driver"

connectionURL="jdbc:mysql://127.0.0.1:3306/mybatis" userId="root"

password="root" />

<!-- 所生成的实体类的位置默认资源包src targetProject对应相应的工程  

targetPackage对应相应的包-->

<javaModelGenerator targetPackage="cn.itcast.model"

targetProject="mybatis-3" />

<!-- 所生成的sqlMap的影射文件的位置,默认资源包src -->

<sqlMapGenerator targetPackage="mybatis.sqlMap"

targetProject="mybatis-3" />

 

<!-- 为哪些表生成代码 tableName:表名 schema:不用填写,其他属性是禁用例子查询的生成

tableName 给哪一个表生成文件就,就用哪张表

 -->

<table schema="" tableName="person" enableCountByExample="false"

enableUpdateByExample="false" enableDeleteByExample="false"

enableSelectByExample="false" selectByExampleQueryId="false">

</table>

 

</context>

</generatorConfiguration>

相关文章
相关标签/搜索