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>

相關文章
相關標籤/搜索