自动生成mybatis映射文件的方法
来源:互联网 发布:测试长相的软件 编辑:程序博客网 时间:2024/05/17 08:47
1,下载mybatis-generator-core-1.3.2.jar包
2,在当前界面打开cmd窗口
3,生成语句:java -jar mybatis-generator-core-1.3.2.jar -configfile generator.xml -overwrite
4,generator.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:数据库的JDBC驱动的jar包地址--> <classPathEntry location="F:\API\jar包\mysql\mysql-connector-java-5.1.7-bin.jar" /> <context id="DB2Tables" targetRuntime="MyBatis3"> <commentGenerator> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true" /> <!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/ndy" userId="root" password="123456"> </jdbcConnection> <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal --> <javaTypeResolver > <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- targetProject:自动生成代码的位置 --> <!--生成的模型的包名和位置--> <javaModelGenerator targetPackage="ndy.model" targetProject="G:\test_mybatis\src"> <!-- enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="true" /> <!-- 从数据库返回的值被清理前后的空格 --> <property name="trimStrings" value="true" /> </javaModelGenerator> <!--生成的映射文件的包名和位置--> <sqlMapGenerator targetPackage="ndy.mapping" targetProject="G:\test_mybatis\src"> <property name="enableSubPackages" value="false" /> </sqlMapGenerator> <!--生成DAO的包名和位置--> <javaClientGenerator type="XMLMAPPER" targetPackage="ndy.dao" targetProject="G:\test_mybatis\src"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <!-- tableName:用于自动生成代码的数据库表;domainObjectName:对应于数据库表的javaBean类名 --> <table tableName="trole" domainObjectName="Role" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"></table> <table tableName="tuser" domainObjectName="User" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"></table> <table tableName="tuser_trole" domainObjectName="UserRole" enableCountByExample="false" enableDeleteByExample="false" enableSelectByExample="false" enableUpdateByExample="false"></table> </context> </generatorConfiguration>
0 0
- 自动生成mybatis映射文件的方法
- mybatis自动生成映射文件
- 使用mybatis的generator自动生成映射文件
- Mybatis--使用mybatis generator插件映射数据库,自动生成pojo对象,dao接口,mapper.xml文件的方法
- mybatis自动生成mapper,dao,映射文件
- mybatis自动生成mapper,dao,映射文件
- mybatis自动生成mapper xml 映射 文件
- Mybatis 自动生成dao及映射文件
- 使用MyBatis-Generator自动生成映射文件
- Java MyBatis自动生成映射文件
- 自动生成ibatis文件及mybatis文件的方法
- MyBatis Generator自动生成MyBatis的映射代码
- MyBatis Generator自动生成MyBatis的映射代码
- 利用mybatis-generator自动生成JavaBean,mapping映射文件等
- 命令+mybatis-generator插件自动生成Mapper映射文件
- 命令+mybatis-generator插件自动生成Mapper映射文件
- 使用mybatis generater 自动生成实体类和映射文件
- MyBatis之自动生成实体类及映射文件《二》
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解
- 办公费帮你
- hadoop 安装错误记录
- v飞的把你奶奶你
- work_weipa_如何在开启了两个相同的activity的情况下退出程序
- 自动生成mybatis映射文件的方法
- 办公费你忙吗某某某
- Codeforces Round #264 (Div. 2)(好)
- v飞的臂膀把高耗能
- github 有activity记录 没有contribution的记录怎么办
- 字符串倒置
- Red Hat Enterprise Linux Server release 5.6 安装 MongoDB 2.6.4
- 官方标准版如何编译webrtc ( how to compile webrtc )
- 【学习干货】给coder的10个读书建议