MyBatis Generator 自动创建代码
来源:互联网 发布:淘宝上如何买衣服 编辑:程序博客网 时间:2024/05/22 08:08
1.导入需要的jar
mybatis-generator-core-1.3.5.jar (下载地址:点击下载jar)
mysql-connector-java-5.1.22-bin.jar
2.配置generatorConfig.xml
<?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.22-bin.jar"/> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <property name="suppressDate" value="true"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <!--数据库链接地址账号密码--> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/dbname" userId="root" password="root"> </jdbcConnection> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!--生成Model类存放位置--> <javaModelGenerator targetPackage="com.model" targetProject="src"> <property name="enableSubPackages" value="true"/> <property name="trimStrings" value="true"/> </javaModelGenerator> <!--生成映射文件存放位置--> <sqlMapGenerator targetPackage="com.mapping" targetProject="src"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!--生成Dao类存放位置--> <javaClientGenerator type="XMLMAPPER" targetPackage="com.dao" targetProject="src"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!--生成对应表及类名--> <table tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> </context></generatorConfiguration>3.在generatorConfig.xml同级目录运行命令
java -jar mybatis-generator-core-1.3.5.jar -configfile generatorConfig.xml -overwrite
2 0
- MyBatis Generator自动创建代码
- MyBatis Generator 自动创建代码
- MyBatis Generator自动创建代码
- MyBatis Generator自动创建代码
- MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 利用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用MyBatis Generator自动创建代码
- 使用mybatis generator自动创建代码
- [SSM]使用MyBatis Generator自动创建代码
- 苹果手机屏幕尺寸
- ios developer tiny share-20161028
- 欢迎使用CSDN-markdown编辑器
- 排序方法的比较
- mysql性能优化学习与实战-1
- MyBatis Generator 自动创建代码
- T-SQL 编程之结果集循环处理
- 杭电HOJ1034 Candy Sharing Game 的一种解法
- 搭建Node.js开发IDE环境WebStrom5
- 工程师手记-升级PNI以支持PHP7
- ionic2上实现跳转应用市场的功能
- Oracle 11g的安装步骤以及注意事项
- Coursera Machine Learning 第二周 quiz Linear Regression with Multiple Variables 习题答案
- Catch That Cow(BFS和queue()用法)