Mybatis使用命令生成逆向工程的方法
MyBatis Generator命令生成
1.下載jar:點(diǎn)擊此處進(jìn)入官網(wǎng)
2.解壓后打開lib在里面創(chuàng)建generatorConfig.xml和一個(gè)src文件夾。
<?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> <!-- 數(shù)據(jù)庫驅(qū)動(dòng)--> <!--選擇自己的mysqljar包的版本--> <classPathEntry location='mysql-connector-java-5.1.26-bin.jar'/> <!-- jdbc.driver=com.mysql.jdbc.Driverurl=jdbc:mysql:///testusername=rootpassword=root--> <context targetRuntime='MyBatis3'> <!-- 注釋 --> <commentGenerator > <property name='suppressAllComments' value='true'/><!-- 是否取消注釋 --> <property name='suppressDate' value='true' /> <!-- 是否生成注釋帶時(shí)間戳--> </commentGenerator> <!-- 以下四個(gè)自己配置--> <jdbcConnection driverClass='com.mysql.jdbc.Driver' connectionURL='jdbc:mysql:///mybatis' userId='root' password='root'> </jdbcConnection> <javaTypeResolver > <property name='forceBigDecimals' value='false'/> </javaTypeResolver> <!-- 修改包名字 targetProject指定類輸出路徑--> <javaModelGenerator targetPackage='com.jty.pojo' targetProject='./src'> <property name='enableSubPackages' value='false'/> <property name='trimStrings' value='true'/> </javaModelGenerator> <sqlMapGenerator targetPackage='com.jty.mapper' targetProject='./src'> <property name='enableSubPackages' value='false'/> </sqlMapGenerator> <javaClientGenerator type='XMLMAPPER' targetPackage='com.jty.mapper' targetProject='./src'> <property name='enableSubPackages' value='false'/> </javaClientGenerator> <!-- 要生成的表 tableName是數(shù)據(jù)庫中的表名或視圖名 domainObjectName是實(shí)體類名--> <table tableName='items' domainObjectName='Items' > </table> <table tableName='orderdetail' domainObjectName='Orderdetail'> </table> <table tableName='orders' domainObjectName='Orders' > </table> <table tableName='user' domainObjectName='User' ></table> </context> </generatorConfiguration>
3.打開cmd依此輸入 cmd?>cd mybatis-generator-core-1.3.7lib
D:mybatis-generator-core-1.3.7lib>java -jar mybatis-generator-core-1.3.7.jar -configfile generatorConfig.xml -overwrite
4.當(dāng)顯示:MyBatis Generator finished successfully.就ok了。
到此這篇關(guān)于Mybatis使用命令生成逆向工程的文章就介紹到這了,更多相關(guān)Mybatis生成逆向工程內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. Microsoft Office Access修改代碼字體大小的方法2. 數(shù)據(jù)庫人員手冊之ORACLE應(yīng)用源碼3. DB2 XML 全文搜索之為文本搜索做準(zhǔn)備4. MySQL中InnoDB和MyISAM類型的差別5. 循序漸進(jìn)講解Oracle數(shù)據(jù)庫管理員的職責(zé)6. debian10 mariadb安裝過程詳解7. MySQL基礎(chǔ)教程9 —— 函數(shù)之日期和時(shí)間函數(shù)8. mssql鎖基礎(chǔ)教程9. MySQL 千萬級(jí)數(shù)據(jù)量如何快速分頁10. Mybatis查詢方法如何實(shí)現(xiàn)沒有返回值
