使用Mybatis-Generator自动生成Model、Mapper相关文件
来源:互联网 发布:超级玛丽c语言源代码 编辑:程序博客网 时间:2024/06/05 09:46
1、首先需要下载一下MyBatis Generator
2、解压mybatis-generator-**.zip
3、将mybatis-generator-core-**.jar,数据库驱动,存放的在一起
4、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="postgresql-9.4.1212.jre7.jar" /> <context id="context1"> <!--数据库链接地址账号密码--> <jdbcConnection driverClass="org.postgresql.Driver" connectionURL="jdbc:postgresql://172.20.68.242:5432/happinet" userId="postgres" password="happinet" /> <!--生成Model类存放位置--> <javaModelGenerator targetPackage="cn.pzh.model" targetProject="src/main/java/" /> <!--生成映射文件存放位置--> <sqlMapGenerator targetPackage="cn.pzh.mapper" targetProject="src/main/resources/" /> <!--生成Mapper接口存放位置--> <javaClientGenerator targetPackage="cn.pzh.mapper" targetProject="src/main/java/" type="XMLMAPPER" /> <!--生成对应表及类名,tableName="%"代表所有表--> <table schema="public" tableName="%" enableInsert="true" enableSelectByPrimaryKey="true" enableSelectByExample="false" enableUpdateByPrimaryKey="true" enableUpdateByExample="false" enableDeleteByPrimaryKey="true" enableDeleteByExample="false" enableCountByExample="false" selectByExampleQueryId="false" modelType="hierarchical"> </table> </context></generatorConfiguration>
5、执行命令生成
java -jar mybatis-generator-core-1.3.5.jar -configfile generatorConfig.xml -overwrite
阅读全文
0 0
- 使用Mybatis-Generator自动生成Model、Mapper相关文件
- 使用Mybatis-Generator自动生成Dao、model和mapper.xml相关文件
- Mybatis使用generator自动生成mapper文件
- 使用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相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 使用Mybatis-Generator自动生成Dao、Model、Mapping相关文件
- 【第七周项目1】建立顺序环形队列算法库
- Go 循环跳转语句使用标签的作用之一
- 75、java异常-finally
- sql多个条件更新
- 使用NFS启动Tiny4412开发板根文件系统
- 使用Mybatis-Generator自动生成Model、Mapper相关文件
- 程序员会用到的东西 有些不常用
- web 性能笔记整理(持续更新)
- js中同步与异步处理的方法和区别总结
- mysql 增删查改-练习
- 常用正则表达式
- 【转】数据库基本知识:(四)数据操作-删和改
- Spark 增量操作 insertInto() 与 mode(SaveMode.Append).saveAsTable() 的区别
- logback mdc