使用Mybatis自动生成工具
来源:互联网 发布:wbinairbook mac os 编辑:程序博客网 时间:2024/05/16 01:13
1.配置如下文件夹结构:
导入相应架包,导入配置信息文件:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE generatorConfigurationPUBLIC "-//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.41-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://127.0.0.1:3306/tsdwork" userId="root" password="123456"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- 生成模型的包名和位置 --> <javaModelGenerator targetPackage="com.tsd.pojo" targetProject="src"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- 生成映射文件的包名和位置 --> <sqlMapGenerator targetPackage="com.tsd.mapping" targetProject="src"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <!-- 生成DAO的包名和位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="com.tsd.dao" targetProject="src"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名 --> <table tableName="student" domainObjectName="Student" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> </context></generatorConfiguration>在配置文件中修改相应位置的信息.
在控制窗口(cmd)运行
Java -jar mybatis-generator-core-1.3.2.jar -configfile generatorConfig.xml -overwrite最终在src文件夹中会出现相应的架包。
1 0
- 使用Mybatis自动生成工具
- 242,使用mybatis代码自动生成工具
- myBatis自动生成工具
- mybatis自动生成工具
- Mybatis自动生成工具
- mybatis自动生成工具
- mybatis 自动生成工具
- mybatis自动生成工具
- Mybatis 自动生成代码工具
- Mybatis 自动生成代码工具
- mybatis代码自动生成工具
- Mybatis SQLMap自动生成工具
- Mybatis 自动生成代码工具
- mybatis自动生成工具-MBG
- 【Mybatis】自动生成代码工具
- Mybatis generatorConfiguration自动生成工具
- mybatis代码自动生成工具
- mybatis mybatis-generator 代码自动生成工具
- CF容器安全
- 内网转外网方法 Sunny-Ngrok
- Java编程思想-并发(5)
- Project facet Java version 1.8 is not supported解决记录
- sql查询语句
- 使用Mybatis自动生成工具
- javaoop集合框架——List接口的常用方法
- nyoj ACM:部分和问题(DFS 回溯 递归)
- 游戏编程中的人工智能技术:前言、目录、序言等
- CodeForces
- Socket传输(下)----客户端
- 利用drawerlayout和NavigationView实现侧滑栏
- BZOJ 2039: [2009国家集训队]employ人员雇佣
- MQCONN failed (Reason = 2277)