mybatis-generator自动生成DAO文件
来源:互联网 发布:长沙理工大学教务网络 编辑:程序博客网 时间:2024/06/05 16:17
下载mybatis-generator包,我放在D盘下。下载地址:
http://download.csdn.net/detail/u012909091/7206091#comment
然后根据需要自己修改generatorConfig.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="mysql-connector-java-5.1.25-bin.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接URL,用户名、密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/test" userId="root" password="6321194">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 生成模型的包名和位置-->
<javaModelGenerator targetPackage="com.wu.pojo" targetProject="D:\mybatis-generator-core-1.3.2\lib\src">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件的包名和位置-->
<sqlMapGenerator targetPackage="com.wu.mapping" targetProject="D:\mybatis-generator-core-1.3.2\lib\src">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wu.Dao" targetProject="D:\mybatis-generator-core-1.3.2\lib\src">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<table tableName="user_t" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
</context>
</generatorConfiguration>
开始运行CMD定位到lib目录:
运行如下代码:
java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite
- mybatis-generator自动生成DAO文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- mybatis generator自动生成DAO、Bean、MapperXML等文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- HDU 2066 一个人的旅行 (SPFA + 链式前向星)
- 掌握JS中的“this” (一)
- Testbench 阻塞赋值与非阻塞赋值
- 图解JSP与Servlet的关系
- 分页居中实现
- mybatis-generator自动生成DAO文件
- 最新版SDWebImage的使用
- Fresco——专为ANDROID加载图片
- winform 自定义控件-按钮
- XMPPFramework初始化、登录、注册详解(附代码)
- Android Storage 路径测试
- Android Studio 如何设置编码方式——诺诺"涂鸦"记忆
- MindMapper 与MindManager之间的区别
- Android使用AsyncHttpClient给APP更新版本并安装