使用MyBatis Generator自动创建代码
来源:互联网 发布:质量好的淘宝店推荐 编辑:程序博客网 时间:2024/06/17 14:16
包下载地址:http://download.csdn.net/detail/lijinzhou2017/9790959
使用MyBatis Generator可以自动生成实体类、DAO接口和Mapping映射文件。
把需要的几个jar包放到一个目录下面,主要是修改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://125.221.1.1/db_124" userId="dem" password="dem">
- </jdbcConnection>
- <javaTypeResolver>
- <property name="forceBigDecimals" value="false"/>
- </javaTypeResolver>
- <!-- 生成模型的包名和位置-->
- <javaModelGenerator targetPackage="test.domain" targetProject="src">
- <property name="enableSubPackages" value="true"/>
- <property name="trimStrings" value="true"/>
- </javaModelGenerator>
- <!-- 生成映射文件的包名和位置-->
- <sqlMapGenerator targetPackage="test.mapping" targetProject="src">
- <property name="enableSubPackages" value="true"/>
- </sqlMapGenerator>
- <!-- 生成DAO的包名和位置-->
- <javaClientGenerator type="XMLMAPPER" targetPackage="test.IDao" targetProject="src">
- <property name="enableSubPackages" value="true"/>
- </javaClientGenerator>
- <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
- <table tableName="user_info_t" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
- </context>
- </generatorConfiguration>
然后介入命令行,切换到当前目录,运行命令
- 1
- 1
如图
阅读全文
0 0
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用mybatis generator自动创建代码
- [SSM]使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- mysql之拷贝表
- 二叉树面试题:判断树是否为完全二叉树和求二叉树的镜像
- H
- HDU 3183 A Magic Lamp (RMQ)
- 集合类
- 使用MyBatis Generator自动创建代码
- Hadoop MultipleInputs.addInputPath 读取多个路径
- 283. Move Zeroes
- ubuntu下执行apt-get update 报异常
- 栈在表达式计算过程中的应用
- HPU DFS + BFS 专项练习A
- hdu 5685 2016"百度之星"
- poj 2229 动态规划
- linux 安装jdk1.7