发布于 2015-11-02 02:28:50 | 230 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的MyBatis教程,程序狗速度看过来!

MyBatis 基于Java的持久层框架

MyBatis 本是apache的一个开源项目iBatis, 2010年这个项目由apache software foundation 迁移到了google code,并且改名为MyBatis 。


MyBatis通用Mapper3,极其方便的使用MyBatis单表的增删改查

最新版本3.3.0

  • 增加对动态表名的支持,需要实体类继承IDynamicTableName接口,用法见详细说明

  • Example增加自定义查询条件,提供了4个方法,具体方法和用法见详细说明

  • 新增@ColumnType注解,可以单独设置列的jdbcType和typeHandler

  • Example的in和not in中的List<Object>参数改为List<?>,允许任意类型

  • select查询方法返回类型不在使用resultType,改为resultMap,因此可以支持typeHandler的读取

  • Style自动转方式新增camelhumpAndUppercase驼峰转下划线大写形式,camelhumpAndLowercase驼峰转下划线小写形式

  • MapperTemplate中的getSelectReturnType方法改为getEntityClass,getBEFORE改为isBEFORE

  • 文档中增加@GeneratedValue(strategy = GenerationType.IDENTITY)的一种重要用法说明

  • 修复selectAll不支持@OrderBy注解的bug

  • 解决一个驼峰转换bug,例如helloWorld会转换为hello_world(原先是hello_World)

使用Maven

<dependency>
    <groupId>tk.mybatis</groupId>
    <artifactId>mapper</artifactId>
    <version>3.3.0</version>
</dependency>

引入Jar包,下载地址:

https://oss.sonatype.org/content/repositories/releases/tk/mybatis/mapper

http://repo1.maven.org/maven2/tk/mybatis/mapper

由于通用Mapper依赖JPA,所以还需要下载persistence-api-1.0.jar:

http://repo1.maven.org/maven2/javax/persistence/persistence-api/1.0/

更多MyBatis相关内容可以访问: www.mybatis.tk



历史版本 :
Mybatis 通用 Mapper 3.4.5 发布,增加代码生成器插件
MyBatis 逆向工程 MyBatis-CMEU v2.1.2 发布
Mybatis 分页插件 PageHelper 5.1.2 发布
mybatis-plus 2.1.1 发布,新增 mybatis 多租户 SQL 解析
MyBatis-Guice 3.10 发布,修复多项错误
mybatis-plus 2.1.1-SNAPSHOT,代号:小锅盖
MyBatis Ignite 1.0.6 发布,MyBatis 缓存插件
MyBatis 3.4.5 发布,Java 数据持久层框架
mybatis-plus 2.1.0 发布,代号:小秋秋
MyBatis 逆向工程 MyBatis-CMEU v2.1.0 发布
Mybatis 分页插件 PageHelper 5.0.4 发布
Mybatis-Plus 2.0.9 发布,简化开发 mybatis 快速入门
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务