Mybatis框架主要作用是为了缩减JDBC的代码。
创建第一个Mybatis
搭建环境
新建一个项目,然后新建一个普通的maven项目,导入maven依赖
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 父工程-->
<groupId>org.example</groupId>
<artifactId>mybatis</artifactId>
<packaging>pom</packaging>
<modules>
<module>mybatis01</module>
</modules>
<version>1.0-SNAPSHOT</version>
<!-- 导入依赖-->
<dependencies>
<!-- mybatis -->
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.16</version>
</dependency>
<!--junit单元测试-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<!--mysql驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
创建一个模板
编写mybatis的核心配置文件mybatis-config.xml
一般都这样命名,注意这里有mappers
映射,之后有一个mapper映射就需要加进去,否则会报错。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/study/dao/UserMapper.xml"/>
</mappers>
</configuration>
编写mybatis工具类主要是用来连接数据库用的所以提取出来。
package com.study.utils;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
public class MybatisUtils {
private static SqlSessionFactory sqlSessionFactory;
static{
try {
//使用mybatis获取sqlSessionFactory对象
String resource = "mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
// 既然有了 SqlSessionFactory,顾名思义,我们可以从中获得 SqlSession 的实例。
// SqlSession 提供了在数据库执行 SQL 命令所需的所有方法
public static SqlSession getSqlSession(){
// SqlSession sqlSession = sqlSessionFactory.openSession();
// return sqlSession;
return sqlSessionFactory.openSession();
}
}
编写实体类代码
package com.study.pojo;
public class User {
private int id;
private String name;
private String pwd;
public User() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", name='" + name + '\'' +
", pwd='" + pwd + '\'' +
'}';
}
}
Dao接口与之前的一样
public interface UserDao {
List<User> getUserList();
}
将之前接口实现类转换成Mapper配置文件,需要填的参数,对应的类,返回的类型已经sql语句
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- namespace=绑定一个Dao/Mapper接口-->
<mapper namespace="com.study.dao.UserDao">
<!-- select查询语句,ID对应方法名-->
<select id="getUserList" resultType="com.study.pojo.User">
select * from mybatis.user
</select>
</mapper>
测试
引入Junit测试。
package com.study.dao;
import com.study.pojo.User;
import com.study.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import java.util.List;
public class UserDaoTest {
@Test
public void test() {
//第一步过的sqlsession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
//执行sql
UserDao mapper = sqlSession.getMapper(UserDao.class);
List<User> userList = mapper.getUserList();
for (User user : userList) {
System.out.println(user);
}
sqlSession.close();
}
}
可能出现的问题:
maven导出资源问题,在pom.xml
中加入这段
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
还有就是mybatis-config.xml
中的映射问题。
<mappers>
<mapper resource="com/study/dao/UserMapper.xml"/>
</mappers>
CRUD
增删改查
将之前的userDao改成userMapper
public interface UserMapper {
List<User> getUserList();
//查
User getUserById(int id);
//增
int addUser(User user);
//删
int deleteUser(int id);
//改
int updateUser(User user);
int addUser2(Map<String,Object> map);
List<User> getUserByMap(String name);
}
编写对应的Mapper.xml中的sql语句
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- namespace=绑定一个Dao/Mapper接口-->
<mapper namespace="com.study.dao.UserMapper">
<!-- select查询语句,ID对应方法名-->
<select id="getUserList" resultType="com.study.pojo.User">
select * from mybatis.user;
</select>
<select id="getUserById" parameterType="int" resultType="com.study.pojo.User">
select * from mybatis.user where id = #{id};
</select>
<insert id="addUser" parameterType="com.study.pojo.User">
insert into mybatis.user(id,name,pwd) values (#{id},#{name},#{pwd});
</insert>
<update id="updateUser" parameterType="com.study.pojo.User">
update mybatis.user set name=#{name},pwd=#{pwd} where id=#{id};
</update>
<delete id="deleteUser" parameterType="int">
delete from mybatis.user where id = #{id};
</delete>
<insert id="addUser2" parameterType="map">
insert into mybatis.user(id,name,pwd) values (#{userid},#{userName},#{passWord});
</insert>
<select id="getUserByMap" parameterType="com.study.pojo.User">
select * from mybatis.user where name like "%"#{value}"%";
</select>
</mapper>
测试:
public class UserMapperTest {
@Test
public void test() {
//第一步过的sqlsession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
//执行sql
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
List<User> userList = mapper.getUserList();
for (User user : userList) {
System.out.println(user);
}
sqlSession.close();
}
@Test
public void addUser() {
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
User user = new User(4,"张","12342");
System.out.println(user);
int res = mapper.addUser(user);
if (res>0){
System.out.println("success");
}
sqlSession.commit();
sqlSession.close();
}
@Test
public void deleteUser() {
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
mapper.deleteUser(4);
sqlSession.commit();
sqlSession.close();
}
@Test
public void updateUser() {
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
mapper.updateUser(new User(4,"aa","123456"));
sqlSession.commit();
sqlSession.close();
}
@Test
public void selectUser() {
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
User user = mapper.getUserById(2);
System.out.println(user);
sqlSession.close();
}
@Test
public void addUser2(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
HashMap<String, Object> map = new HashMap<>();
map.put("userid",6);
map.put("userName","lll");
map.put("passWord","45121");
mapper.addUser2(map);
sqlSession.commit();
sqlSession.commit();
}
@Test
public void likea(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
List<User> userList = mapper.getUserByMap("狂");
for (User user : userList) {
System.out.println(user);
}
sqlSession.close();
}
}
常见的错误:
标签不要匹配错
resource绑定mapper,需要使用路径
程序配置文件必须符合规范
空指针异常,没有注册到资源
target输出xml文件中存在中文乱码问题
maven资源没有导出问题
万能map
当我们参数过多我们就需要考虑使用map,
int addUser2(Map<String,Object> map);
<insert id="addUser2" parameterType="map">
insert into mybatis.user(id,name,pwd) values (#{userid},#{userName},#{passWord});
</insert>
@Test
public void addUser2(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
HashMap<String, Object> map = new HashMap<>();
map.put("userid",6);
map.put("userName","lll");
map.put("passWord","45121");
mapper.addUser2(map);
sqlSession.commit();
sqlSession.commit();
}
map传递参数,直接在sql中取出key即可
对象传递参数,直接在sql中取对象的属性即可。
只有一个基本类型参数的情况下,可以直接在sql中取到
多个参数用Map或注解
模糊查询
两种方式一种在sql语句中加入%
select * from mybatis.user where name like "%"#{value}"%";
另一种是在java代码中加入%
List<User> userList = mapper.getUserByMap("%狂%");
配置
mybatis-config.xml
中配置属性,装配db.properties
文件注意在这里面不需要对&
进行转译,直接使用&
即可,不用&
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF-8
username=root
password=123456
这个properties
必须在最前面。
<properties resource="db.properties"/>
<environments default="development"> <!--在这里选择对应的运行环境-->
<environment id="development"> <!--可以配置多套运行环境-->
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
类型别名
在mybatis-config.xml
中配置类型别名.
注意下面的顺序不要变,
<!-- 导入其他文件-->
<properties resource="db.properties"/>
<!-- setting个性化设置比如日志-->
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
<!-- 可以给实体类取别名-->
<typeAliases>
<typeAlias type="com.study.pojo.Teacher" alias="Teacher"/>
<typeAlias type="com.study.pojo.Student" alias="Student"/>
</typeAliases>
这样在编写sql文件中就可以如下上面是不起别名之前的,后面是起别名之后的.
<select id="getTeacher" resultMap="com.study.pojo.Teacher"></select>
<select id="getTeacher" resultMap="Teacher"></select>
还有一种方式:直接在类前面加注解
@Alias("author")
public class Author {
...
}
Public Key Retrieval is not allowed出现这个bug
解决方法设置为下面
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/mybatis?useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true
映射器
MapperRegistry:注册绑定我们的Mapper文件,每写一个dao层就要写一个Mapper文件
方式一:
<!-- 每一个Mapper.xml都需要在MyBatis核心配置文件中注册-->
<mappers>
<mapper resource="com/qjd/dao/UserMapper.xml"/>
</mappers>
方式二:
<!-- 使用映射器接口实现类的完全限定类名 -->
<mappers>
<mapper class="org.mybatis.builder.AuthorMapper"/>
</mappers>
注意:
- 接口和他的Mapper配置文件必须同名
- 接口和他的Mapper配置文件必须在同一个包下
方式三:
<!-- 将包内的映射器接口实现全部注册为映射器 -->
<mappers>
<package name="org.mybatis.builder"/>
</mappers>
注意:
- 接口和他的Mapper配置文件必须同名
- 接口和他的Mapper配置文件必须在同一个包下
解决属性名和字段名不一致的问题
数据库中的字段名是pwd,实体类中的属性名为password.这样是找不到数据库的.所以需要解决.
方法一,:将类里面的属性名改成与字段名一致.纯废话
方法二:起别名
select id,name,pwd as password from mybatis.user where id =#{id}
resultMap结果集映射
<!-- 结果集映射-->
<resultMap id="UserMap" type="User">
<!-- column数据库中的字段,properties实体类中的属性-->
<result column="id" property="id"/>
<result column="name" property="name"/>
<result column="pwd" property="password"/>
</resultMap>
日志
分页
使用Limit分页数据库
使用数据库分解
//分页
List<User> getUserByLimit(Map<String,Integer> map);
<!-- 分页-->
<select id="getUserByLimit" parameterType="map" resultMap="UserMap">
select * from mybatis.user limit #{startIndex},#{pageSize}
</select>
@Test
public void getUserByLimit(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
HashMap<String, Integer> map = new HashMap<>();
map.put("startIndex",1);
map.put("pageSize",2);
List<User> userList = mapper.getUserByLimit(map);
for (User user : userList) {
System.out.println(user);
}
sqlSession.close();
使用java分页RowBounds分页
不需要使用sql实现分页
//分页2
List<User> getUserByRowBounds();
mapper.xml
<!-- 分页2-->
<select id="getUserByRowBounds" resultMap="UserMap">
select * from mybatis.user
</select>
测试
@Test
public void getUserByRowBounds(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
//RowBounds实现
RowBounds rowBounds = new RowBounds(1, 2);
//通过java代码层面实现分页
List<User> userList = sqlSession.selectList("com.qjd.dao.UserMapper.getUserByRowBounds",null,rowBounds);
for (User user : userList) {
System.out.println(user);
}
sqlSession.close();
}
分页插件PageHelper
如何使用----https://pagehelper.github.io/docs/howtouse/
使用注解开发
注解直接在接口上完成
public interface UserMapper {
@Select("select * from user")
List<User> getUsers();
}
然后别忘了在核心配置文件中绑定接口
<!--绑定接口-->
<mappers>
<mapper class="com.qjd.dao.UserMapper"/>
</mappers>
测试也是行得通的
public class UserMapperTest {
@Test
public void test(){
SqlSession sqlSession = MybatisUtils.getSqlSession();
//底层主要应用反射
UserMapper mapper = sqlSession.getMapper(UserMapper.class);
List<User> users = mapper.getUsers();
for (User user : users) {
System.out.println(user);
}
sqlSession.close();
}
}
CRUD
设置自动提交事务
public static SqlSession getSqlSession(){
return sqlSessionFactory.openSession(true);
}
编写接口,添加注解
public interface UserMapper {
@Select("select * from user")
List<User> getUsers();
//方法存在多个参数,所有的参数前面前面必须加上 @Param("") 注解
@Select("select * from user where id=#{id}")
User getUserByID(@Param("id") int id);
@Insert("insert into user(id,name,pwd) values(#{id},#{name},#{password})")
int addUser(User user);
@Update("update user set name=#{name},pwd=#{password} where id=#{id}")
int updateUser(User user);
@Delete("delete from user where id=#{uid}")
int deleteUser(@Param("uid") int id);
}
关于 @Param(“”) 注解
基本类型的参数或者String需要加上
引用类型不需要加
如果只有一个基本类型的话,可以忽略,但是建议大家都加上
我们在sql中引用的就是我们这里的@Param(“”)中设定的属性名
Lombok
自动生成实体类的get,set,toString,无参有参构造函数等.
- 在IDEA中安装Lombok插件
- 在项目中导入lombok依赖
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
- 在实体类上加注解即可
@Data //get,set
@AllArgsConstructor //所有参数构造
@NoArgsConstructor //无参构造
public class User {
private int id;
private String name;
private String password;
}
还有好多参数
@Getter and @Setter
@FieldNameConstants
@ToString
@EqualsAndHashCode
@AllArgsConstructor, @RequiredArgsConstructor and @NoArgsConstructor
@Log, @Log4j, @Log4j2, @Slf4j, @XSlf4j, @CommonsLog, @JBossLog, @Flogger, @CustomLog
@Data
@Builder
@SuperBuilder
@Singular
@Delegate
@Value
@Accessors
@Wither
@With
@SneakyThrows
@val
@var
experimental @var
@UtilityClass
多对一
@Data
public class Student {
private int id;
private String name;
private Teacher teacher;
}
@Data
public class Teacher {
private int id;
private String name;
}
public interface StudentMapper {
List<Student> getStudent();
List<Student> getStudent2();
}
第一种方法(建议这种,这种,sql语句难一点,后面简单一点) mapper.xml
<select id="getStudent2" resultMap="StudentTeacher">
select s.id sid,s.name sname, t.name tname
from student s,teacher t
where s.tid = t.id;
</select>
<resultMap id="StudentTeacher" type="Student">
<result property="id" column="sid"/>
<result property="name" column="sname"/>
<association property="teacher" javaType="Teacher">
<result property="name" column="tname"/>
</association>
</resultMap>
第二种(sql简单,但后面难)
<select id="getStudent" resultMap="StudentTeacher">
select *from mybatis.student;
</select>
<resultMap id="StudentTeacher" type="Student">
<result property="id" column="id"/>
<result property="name" column="name"/>
<!--复杂的属性我们需要单独处理-->
<!--对象:association-->
<!-- 集合:collection -->
<association property="teacher" column="tid" javaType="Teacher" select="getTeacher"/>
</resultMap>
<select id="getTeacher" resultType="Teacher">
select *from mybatis.teacher where id=#{id}
</select>
一对多
@Data
public class Student {
private int id;
private String name;
private int tid;
}
@Data
public class Teacher {
private int id;
private String name;
//一个老师拥有多个学生
private List<Student> students;
}
第一种:(sql难一点,后面简单)
<select id="getTeacher" resultMap="TeacherStudent">
select s.id sid, s.name sname,t.name tname,t.id tid
from student s,teacher t
where s.tid = t.id and t.id=#{tid}
</select>
<resultMap id="TeacherStudent" type="Teacher">
<result property="id" column="tid"/>
<result property="name" column="tname"/>
<collection property="students" ofType="Student">
<result property="id" column="sid"/>
<result property="name" column="sname"/>
<result property="tid" column="tid"/>
</collection>
</resultMap>
第二种(sql简单,后面难)
<select id="getTeacher2" resultMap="TeacherStudent2">
select *from mybatis.teacher where id=#{tid}
</select>
<resultMap id="TeacherStudent2" type="Teacher">
<collection property="students" column="id" javaType="ArrayList" ofType="Student" select="getStudentByTeacherId"/>
</resultMap>
<select id="getStudentByTeacherId" resultType="Student">
select *from mybatis.student where tid =#{tid}
</select>
小结
- 关联-association 【多对一】
- 集合-collection 【一对多】
javaType & ofType
3.1 javaType用来指定实体类中属性的类型
3.2 ofType用来指定映射到List或者集合中的pojo类型,泛型中的约束类型
注意点:
- 保证sql的可读性,尽量保重通俗易懂
- 注意一对多和多对一中属性名和字段的问题
- 如果问题不好排查错误,可以使用日志,建议使用log4j
动态SQL
什么是动态SQL:动态SQL就是根据不同的条件生成不同的SQL语句
- if
- choose (when, otherwise)
- trim (where, set)
- foreach
IF
<select id="queryBlogIF" parameterType="map" resultType="blog">
select *from mybatis.blog where 1=1
<if test="title != null">
and title = #{title}
</if>
<if test="author != null">
and author = #{author}
</if>
</select>
choose,when,otherwise
在下面中选择一个,
如果这个成立执行这个
上面的都没成立就执行这个
<select id="queryBlogChoose" parameterType="map" resultType="blog">
select *from mybatis.blog
<where><!--自动加where,如果有就加-->
<choose>
<when test="title !=null">
title = #{title}
</when>
<when test="author !=null">
and author = #{author}
</when>
<otherwise>
and views = #{views}
</otherwise>
</choose>
</where>
</select>
trim、where、set
里如果有成立的自动在sql后面加上where已经成立的sql语句.where 元素只会在子元素返回任何内容的情况下才插入 “WHERE” 子句。而且,若子句的开头为 “AND” 或 “OR”,where 元素也会将它们去除
元素会动态地在行首插入 SET 关键字,并会删掉额外的逗号(这些逗号是在使用条件语句给列赋值时引入的)`
<update id="updateBlog" parameterType="map">
update mybatis.blog
<set>
<if test="title != null">
title = #{title},
</if>
<if test="author != null">
author = #{author}
</if>
</set>
where id = #{id}
</update>
trim可以选择where或者set.
<trim prefix="WHERE" prefixOverrides="AND |OR ">
...
</trim>
缓存
一级缓存
一级缓存也叫本地缓存:
与数据库同一次会话期间查询到的数据会放在本地缓存中。只要当前sqlSession.close();
这个不注销就可以直接访问,不用访问数据库.
- 缓存失效
1.查询不同的东西
2,增删改操作,可能会改变原来的数据,所以必定会刷新缓存!
3.查询不同的Mapper.xml
4.手动清理缓存!
小结:一级缓存默认是开启的,只在一次SqlSession中有效,也就是拿到连接到关闭连接这个区间段(相当于一个用户不断查询相同的数据,比如不断刷新),一级缓存就是一个map
二级缓存
- 开启全局缓存
<!-- 显示的开启全局缓存-->
<setting name="cacheEnable" value="true"/>
在要使用二级缓存的Mapper中开启,
二级缓存只存在与这个Mapper中,可以不加参数
<!-- 在当前Mapper.xml中使用二级缓存-->
<cache eviction="FIFO"
flushInterval="60000" 时间
size="512"
readOnly="true"/>
问题:
- 我们需要将实体类序列化(实现Serializable接口),否则就会报错
sqlsession关闭的时候一定要在最后关闭,不能先关闭sqlsession再关闭sqlsession2,这样会导致Cause:
org.apache.ibatis.executor.ExecutorException: Executor was closed
4.小结
只要开启了二级缓存,在同一个Mapper下就有效
所有的数据都会先放在一级缓存中
只有当会话提交,或者关闭的时候才会提交到二级缓存中
缓存原理
先到二级缓存中找,找不到去一级缓存中找,再找不到去数据中找,找完上传到一级缓存,然后上传到二级缓存.
自定义缓存—ehcache
<dependency>
<groupId>org.mybatis.caches</groupId>
<artifactId>mybatis-ehcache</artifactId>
<version>1.1.0</version>
</dependency>
实现方式
<cache type="org.mybatis.caches.ehcache.EhcacheCache"/>