1.所需的jar 包
mybatis-3.0.4.jar 、mybatis-generator-core-1.3.1.jar 、 mysql-connector-java-5.1.13.jar
mybatis下载地址:http://code.google.com/p/mybatis/
2.新建文件夹
新建文件夹E://mygen,将以上三个文件放入夹
3.同目录创建
generator.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="E:\workspace10\mydemo\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.13.jar" />
<context id="MYSQLTables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/renwu" userId="root" password="root">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<javaModelGenerator targetPackage="com.hc360.renwu.po" targetProject="E:\workspace10\renwu\src\main\java\com\hc360\renwu\po">
<property name="enableSubPackages" value="false" />
<property name="trimStrings" value="false" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="com.hc360.qiye.renwu.mapper" targetProject="E:\workspace10\renwu\src\main\java\com\hc360\renwu\dao\mapper">
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.hc360.renwu.dao" targetProject="E:\workspace10\renwu\src\main\java\com\hc360\renwu\dao">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 -->
<table tableName="achievement" domainObjectName="Achievement" schema="renwu" enableInsert="true"
enableSelectByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false"
enableCountByExample="false" enableUpdateByExample="false">
<property name="useActualColumnNames" value="false" />
</table>
<table tableName="city" domainObjectName="City" schema="renwu" enableInsert="true"
enableSelectByPrimaryKey="true" enableSelectByExample="false" enableDeleteByExample="false"
enableCountByExample="false" enableUpdateByExample="false">
<property name="useActualColumnNames" value="false" />
</table>
</context>
</generatorConfiguration>
4.执行命令完成。
cmd ----E:-----cd E://mygen----Java -jar mybatis-generator-core-1.3.1.jar -configfile generator.xml -overwrite
分享到:
相关推荐
Mybatis自动生成实体类,XML文件
启动项目自动生成对应实体的数据库表,示例中自动生成SysUser,User实体对应的数据库表sys_user,user 依赖包文件(可选) maven管理依赖包,自动下载 链接:...
里面包含说明使用方法,主要是mybatis生成mysql 数据库表并生成mapper对象和xml,此jar包请解压后,查看源码
mybatis自动生成实体类和mapper文件。自动添加实体类注释。
1、在某一个磁盘下新建一个文件夹:例如在E盘下创建一个mybatisTable,将mybatis-3.2.2.jar,mybatis-generator-core-1.3.2.jar,mysql-connector-java-5.1.24-bin.jar放入mybatisTable文件夹中。 2、新建一个...
mybatis自动生成全部文件mybatis-generator.xml mybatis-generator-core-1.3.1.jar mysql-connector-java-5.0.8-bin.jar
mybatis自动生成代码
MyBatis自动生成配置文件全解.zip MyBatis自动生成配置文件全解.zip MyBatis自动生成配置文件 全解.zip
myBatis自动生成代码案例
自动生成mysql与sqlserver,可自动生成实体类与dao文件,简单方便,只需要修改confif.xml即可
Mybatis自动生成工具-脚本生成,使用脚本生成.
可以将数据库中的表,自动生成对应的类,和mapper文件。
关于mybatis自动生成语句,还有一些jar,需要的联系我
用来生成 mybatis mapper,do对象,自动生成代码的工具,
mybatis自动生成工具类,更改数据库表名即可
mybatis自动生成实体表 mybatis-generator-core generatorConfig
mybatis 自动生成PO,DAO,mapping代码工具。
通过mybatis将数据库的表自动生成代码和配置文件。