<?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>
<context id="ID " defaultModelType="flat">
<jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver" connectionURL="jdbc:sqlserver://地址:端口;DatabaseName=数据库名称" userId="用户名" password="密码" />
<javaModelGenerator targetPackage="com.包名.entity.main" targetProject="存放项目名称" />
<sqlMapGenerator targetPackage="com.包名.dao.main.mapping.sqlserver" targetProject="存放项目名称" />
<javaClientGenerator targetPackage="com.包名.dao.main" targetProject="存放项目名称" type="XMLMAPPER" />
<table tableName="表名称(与数据库同步)" enableCountByExample="flase" enableUpdateByExample="flase" enableDeleteByExample="flase" enableSelectByExample="flase" selectByExampleQueryId="flase"></table>
</context>
</generatorConfiguration>
例子:
<?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>
<context id="sky" defaultModelType="flat">
<jdbcConnection driverClass="com.microsoft.sqlserver.jdbc.SQLServerDriver" connectionURL="jdbc:sqlserver://192.168.0.66:1433;DatabaseName=database1" userId="admin" password="123sky3" />
<javaModelGenerator targetPackage="com.sky.demo.other.entity.main" targetProject="demo-other-main" />
<sqlMapGenerator targetPackage="com.sky.demo.other.dao.main.mapping.sqlserver" targetProject="demo-other-main" />
<javaClientGenerator targetPackage="com.sky.demo.other.dao.main" targetProject="demo-other-main" type="XMLMAPPER" />
<table tableName="u_student" enableCountByExample="flase" enableUpdateByExample="flase" enableDeleteByExample="flase" enableSelectByExample="flase" selectByExampleQueryId="flase"></table>
</context>
</generatorConfiguration>