mybatis自动生成代码generator
来源:互联网 发布:万能试验机软件 编辑:程序博客网 时间:2024/04/30 13:22
mybatis-generator-core-1.3.2.jar包
编写genertor的xml文件,名下: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> <!-- 数据库的JDBC驱动的jar包地址--> <classPathEntry location="D:\mysql-connector-java-5.1.13-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/test" userId="root" password="root" /> <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer true,把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal --> <javaTypeResolver > <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- 自动生成代码的包名和位置,targetProject可以写绝对路径也可以写项目名 --> <javaModelGenerator targetPackage="com.test.model" targetProject="E:\eclipse\workspace\ssm\src"> <!-- 是否让schema作为包的后缀 --> <property name="enableSubPackages" value="true" /> <!-- 生成的映射文件报名和位置 --> <sqlMapGenerator targetPackage="com.test.mapper" targetProject="ssm" /> <!-- 生成DAO的包名和位置 --> <javaClientGenerator targetPackage="com.test.mapper" targetProject="ssm" type="XMLMAPPER" /> <!-- 从数据库返回的值被清理前后的空格 --> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- domainObjectName是表对应的实体类名, tableName是对应的表名--> <!-- table可以配置多个,enable*几个参数是为了自动生成一些额外的sql操作,可以关闭--> <!-- schema即为数据库名, tableName为对应的数据库表, domainObjectName是要生成的实体类, 如果想要mapper配置文件加入sql的where条件查询, 可以将enableCountByExample等设为true, 这样就会生成一个对应domainObjectName的Example类, enableCountByExample等设为false时, 就不会生成对应的Example类了. 如果table里边不配置property,默认字段都生成为类属性。 <ignoreColumn column="FRED" />//忽略字段 <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />//无论字段是什么类型,生成的类属性都是varchar。 --> <table schema="test" tableName="user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> </context> </generatorConfiguration>
阅读全文
0 0
- Generator-Mybatis自动生成代码
- MyBatis Generator自动生成代码
- mybatis-generator自动生成代码
- mybatis自动生成代码generator
- MyBatis Generator 自动生成代码
- Mybatis-Generator自动生成代码
- MyBatis-generator 自动生成代码
- mybatis-generator自动生成代码
- mybatis-generator【mybatis代码自动生成】
- MBG(MyBatis Generator):MyBatis自动代码生成;
- mybatis mybatis-generator 代码自动生成工具
- 使用MyBatis-generator 自动生成MyBatis代码
- mybatis mybatis-generator 代码自动生成工具
- MyBatis使用Generator自动生成代码
- MyBatis使用Generator自动生成代码
- 用mybatis generator自动生成代码
- 使用MyBatis generator自动生成代码
- maven + MyBatis Generator 自动生成代码配置
- RabbitMQ 入门资料
- 2274: [Usaco2011 Feb]Generic Cow Protests
- 电脑上访问一个网页,整个过程是怎么样的:DNS、HTTP、TCP、OSPF、IP、ARP。
- xymon详细安装教程
- java内部类
- mybatis自动生成代码generator
- echarts 折线分段显示不同颜色
- Google 出品的 Protocol Buffer,别只会用 JSON 和 XML 了
- smali
- 安全渗透测试笔记-----------开写封面
- ubuntu下ccv库配置及DPM等算法demo
- JavaScript中的变量就是变量,不会随着=右边的改变而改变
- Servlet笔记——(1.3.1)第一个手动Servlet程序
- Java中三种交换值得方式