12、动态SQL
所谓的动态SQL,本质还是SQL语句,只是我们可以在SQL层面,去执行一个逻辑代码
什么是动态SQL:动态SQL就是 指根据不同的条件生成不同的SQL语句
查询搜索的时候用的多
12.1 搭建环境
大致过程
1、创建数据表
2、新建实体类
3、编写实体类对应Mapper接口
4、和Mapper.XML文件
5、修改mybatis 核心配置文件
6、测试单元
1、创建数据表
CREATE TABLE `blog` (
`id` int(10) NOT NULL COMMENT '博客id',
`title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '博客标题',
`author` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '博客作者',
`create_time` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '创建时间',
`views` int(30) NOT NULL COMMENT '浏览量'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
2、创建 Blog 实体类
@Data //get,set
@NoArgsConstructor //无参构造
@AllArgsConstructor //有参构造
public class Blog {
private String id;
private String title;
private String author;
private Date createTime; //属性名和字段名不一致
private int views;
}
3、编写实体类对应Mapper接口
/**
* @author zyz
* @version 1.0
* @data 2023/11/23 11:18
* @Description:
*/
public interface BlogMapper {
/**
* @description: IF的使用 查询博客
* @author: zhengyuzhu
* @date: 2023/11/23 11:27
* @param: map
* @return: com.zyz.mybatis.entity.Blog
**/
Blog queryBlogIF(HashMap<String,Object> map);
/**
* @description: choose (when, otherwise)的使用 查询博客
* @author: zhengyuzhu
* @date: 2023/11/23 11:30
* @param: map
* @return: com.zyz.mybatis.entity.Blog
**/
Blog queryBlogChoose(HashMap<String,Object> map);
/**
* @description: trim (where, set)的使用 查询
* @author: zhengyuzhu
* @date: 2023/11/23 11:34
* @param: map
* @return: com.zyz.mybatis.entity.Blog
**/
Blog queryBlogIFTwo(HashMap<String,Object> map);
/**
* @description: trim (where, set)的使用 修改
* @author: zhengyuzhu
* @date: 2023/11/23 11:35
* @param: map
**/
void updateBlog(HashMap<String,Object> map);
/**
* @description: Foreach 的使用
* @author: zhengyuzhu
* @date: 2023/11/23 14:02
* @param: map
* @return: java.util.List<com.zyz.mybatis.entity.Blog>
**/
List<Blog> queryBlogForeach(HashMap<String,Object> map);
/**
* @description: IF的使用 使用代码片段
* @author: zhengyuzhu
* @date: 2023/11/23 11:27
* @param: map
* @return: com.zyz.mybatis.entity.Blog
**/
Blog queryBlogIFThree(HashMap<String,Object> map);
}
4、修改mybatis 核心配置文件
<!-- 1、使用映射器 -->
<mappers>
<mapper resource="com/zyz/mybatis/mapper/BlogMapper.xml"/>
</mappers>
具体的动态SQL 编写以及具体的 测试单元分成如下小节
12.2 IF
mapper.xml 文件
由于 实体类 和 数据库 字段不一致,这里进行了映射
<!-- 结果集映射 -->
<resultMap id="BlogMap" type="Blog">
<!--column数据库中的字段,property实体类中的属性-->
<result column="id" property="id" />
<result column="title" property="title" />
<result column="author" property="author" />
<result column="create_time" property="createTime" />
<result column="views" property="views" />
</resultMap>
<!--IF的使用 查询博客-->
<select id="queryBlogIF" parameterType="map" resultMap="BlogMap">
select * from blog where 1=1
<if test="title != null">
and title = #{title}
</if>
<if test="author != null">
and author = #{author}
</if>
</select>
测试单元
/**
* @description: IF 测试
* @author: zhengyuzhu
* @date: 2023/11/23 12:46
**/
@Test
public void testDemo1(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
HashMap<String, Object> blogMap = new HashMap<>();
blogMap.put("title","张麻子娶亲");
blogMap.put("author","张老头");
Blog blog = blogMapper.queryBlogIF(blogMap);//查询
System.out.println(blog);
sqlSession.close();
/**
*
*
* blogMap.put("title","张麻子娶亲");
* blogMap.put("author","张老头");
*
* 查询条件两个:输出如下:
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 846947180.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Preparing: select * from blog where 1=1 and title = ? and author = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Parameters: 张麻子娶亲(String), 张老头(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@327b636c]
*
*
* blogMap.put("title","张麻子娶亲");
* 查询条件一个输出如下
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 1172131546.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Preparing: select * from blog where 1=1 and title = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Parameters: 张麻子娶亲(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@45dd4eda]
*
*
*
*
**/
}
12.3 choose (when, otherwise)
mapper.xml 文件
这里也进行了结果集映射,如上
<!--choose (when, otherwise)的使用 查询博客-->
<select id="queryBlogChoose" parameterType="map" resultMap="BlogMap">
select * from blog
<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>
测试单元
/**
* @description: choose 测试 when otherwise
* @author: zhengyuzhu
* @date: 2023/11/23 13:34
**/
@Test
public void testDemo2(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
HashMap<String, Object> blogMap = new HashMap<>();
// blogMap.put("title","张麻子娶亲");
// blogMap.put("author","张老头");
blogMap.put("views",30);
Blog blog = blogMapper.queryBlogChoose(blogMap);
System.out.println(blog);
sqlSession.close();
/**
*
* 1、多个参数不会拼接,哪个有值 用哪个
*
* blogMap.put("title","张麻子娶亲");
* blogMap.put("author","张老头");
*
* 查询条件两个 但是拼接的时候 第一个有值,就不会在拼接接下来的数据
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 846947180.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Preparing: select * from blog WHERE title = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Parameters: 张麻子娶亲(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@327b636c]
*
*
* blogMap.put("author","张老头");
* 2、查询条件一个输出如下
*
[org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 1172131546.
[com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Preparing: select * from blog WHERE author = ?
[com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Parameters: 张老头(String)
[com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-<== Total: 1
Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
[org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@45dd4eda]
*
*
*
* 3、查询条件 一个 都不满足情况 otherwise
* blogMap.put("views",30);
*
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Preparing: select * from blog WHERE views = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-==> Parameters: 30(Integer)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogChoose]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@45dd4eda]
*
**/
}
12.4 trim (where, set)
mapper.xml 文件
这里也进行了结果集映射,如上
<!--trim (where, set)的使用 查询-->
<select id="queryBlogIFTwo" parameterType="map" resultMap="BlogMap">
select * from blog
<where>
<if test="title != null">
and title = #{title}
</if>
<if test="author != null">
and author = #{author}
</if>
</where>
</select>
<!--trim (where, set)的使用 修改-->
<update id="updateBlog" parameterType="map">
update blog
<set>
<if test="title != null">
title = #{title},
</if>
<if test="author != null">
author = #{author}
</if>
</set>
where id = #{id}
</update>
测试单元
/**
* @description: trim (where, set)的使用 查询
* @author: zhengyuzhu
* @date: 2023/11/23 13:36
**/
@Test
public void testDemo3(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
HashMap<String, Object> blogMap = new HashMap<>();
blogMap.put("title","张麻子娶亲");
blogMap.put("author","张老头");
Blog blog = blogMapper.queryBlogIFTwo(blogMap);//查询
System.out.println(blog);
sqlSession.close();
/**
*
*
* blogMap.put("title","张麻子娶亲");
* blogMap.put("author","张老头");
* 查询条件两个:输出如下:
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 846947180.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Preparing: select * from blog WHERE title = ? and author = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Parameters: 张麻子娶亲(String), 张老头(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@327b636c]
*
*
* blogMap.put("title","张麻子娶亲");
* 查询条件一个输出如下
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 1172131546.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Preparing: select * from blog where 1=1 and title = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Parameters: 张麻子娶亲(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@45dd4eda]
*
*
*
*
**/
}
/**
* @description: trim (where, set)的使用 修改
* @author: zhengyuzhu
* @date: 2023/11/23 13:36
**/
@Test
public void testDemo4(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
HashMap<String, Object> blogMap = new HashMap<>();
blogMap.put("title","张麻子娶亲");
blogMap.put("author","张老头");
Blog blog = blogMapper.queryBlogIFTwo(blogMap);//查询
System.out.println("修改前的数据:" + blog);
HashMap<String, Object> blogMapTwo = new HashMap<>();
blogMapTwo.put("id",1);
blogMapTwo.put("title","如何学号java ?");
blogMapTwo.put("author","小明");
Blog blog1 = new Blog();
blog1.setAuthor("如何学号java ?");
blog1.setAuthor("小明");
blogMapper.updateBlog(blogMapTwo);//修改
HashMap<String, Object> blogMap3 = new HashMap<>();
blogMap3.put("title","如何学号java ?");
Blog blog2 = blogMapper.queryBlogIFTwo(blogMap3);//查询
System.out.println("修改后的数据:" + blog2);
sqlSession.close();
/**
*
*
* blogMapTwo.put("id",1);
* blogMapTwo.put("title","如何学号java ?");
* blogMapTwo.put("author","小明");
* 查询条件两个:输出如下:
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 846947180.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Preparing: select * from blog WHERE title = ? and author = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Parameters: 张麻子娶亲(String), 张老头(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-<== Total: 1
* 修改前的数据:Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [com.zyz.mybatis.mapper.BlogMapper.updateBlog]-==> Preparing: update blog SET title = ?, author = ? where id = ?
* [com.zyz.mybatis.mapper.BlogMapper.updateBlog]-==> Parameters: 如何学号java ?(String), 小明(String), 1(Integer)
* [com.zyz.mybatis.mapper.BlogMapper.updateBlog]-<== Updates: 1
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Preparing: select * from blog WHERE title = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-==> Parameters: 如何学号java ?(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIFTwo]-<== Total: 1
* 修改后的数据:Blog(id=1, title=如何学号java ?, author=小明, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@327b636c]
*
*
*
**/
}
12.5 foreach
更详细的资料参考:mybatis之foreach用法
foreach元素的属性主要有item,index,collection,open,separator,close。
item:集合中元素迭代时的别名,该参数为必选。
index:在list和数组中,index是元素的序号,在map中,index是元素的key,该参数可选
open:foreach代码的开始符号,一般是(和close=")"合用。常用在in(),values()时。该参数可选
separator:元素之间的分隔符,例如在in()的时候,separator=","会自动在元素中间用“,“隔开,避免手动输入逗号导致sql错误,如in(1,2,)这样。该参数可选。
close: foreach代码的关闭符号,一般是)和open="("合用。常用在in(),values()时。该参数可选。
collection: 要做foreach的对象,作为入参时,List对象默认用"list"代替作为键,数组对象有"array"代替作为键,Map对象没有默认的键。当然在作为入参时可以使用@Param(“keyName”)来设置键,设置keyName后,list,array将会失效。 除了入参这种情况外,还有一种作为参数对象的某个字段的时候。举个例子:如果User有属性List ids。入参是User对象,那么这个collection = “ids”.如果User有属性Ids ids;其中Ids是个对象,Ids有个属性List id;入参是User对象,那么collection = “ids.id”
在使用foreach的时候最关键的也是最容易出错的就是collection属性,该属性是必须指定的,但是在不同情况下,该属性的值是不一样的,主要有一下3种情况:
如果传入的是单参数且参数类型是一个List的时候,collection属性值为list .
如果传入的是单参数且参数类型是一个array数组的时候,collection的属性值为array .
如果传入的参数是多个的时候,我们就需要把它们封装成一个Map了,当然单参数也可以封装成map,实际上如果你在传入参数的时候,在MyBatis里面也是会把它封装成一个Map的,map的key就是参数名,所以这个时候collection属性值就是传入的List或array对象在自己封装的map里面的key.
针对最后一条,我们来看一下官方说法:
注意 你可以将一个 List 实例或者数组作为参数对象传给 MyBatis,当你这么做的时候,MyBatis 会自动将它包装在一个 Map 中并以名称为键。List 实例将会以“list”作为键,而数组实例的键将是“array”。
所以,不管是多参数还是单参数的list,array类型,都可以封装为map进行传递。如果传递的是一个List,则mybatis会封装为一个list为key,list值为object的map,如果是array,则封装成一个array为key,array的值为object的map,如果自己封装呢,则colloection里放的是自己封装的map里的key值。
mapper.xml 文件
这里也进行了结果集映射
<!--
foreach元素的属性主要有item,index,collection,open,separator,close。
● item:集合中元素迭代时的别名,该参数为必选。
● index:在list和数组中,index是元素的序号,在map中,index是元素的key,该参数可选
● open:foreach代码的开始符号,一般是(和close=")"合用。常用在in(),values()时。该参数可选
● separator:元素之间的分隔符,例如在in()的时候,separator=","会自动在元素中间用“,“隔开,避免手动输入逗号导致sql错误,如in(1,2,)这样。该参数可选。
● close: foreach代码的关闭符号,一般是)和open="("合用。常用在in(),values()时。该参数可选。
● collection: 要做foreach的对象,作为入参时,List对象默认用"list"代替作为键,数组对象有"array"代替作为键,Map对象没有默认的键。
当然在作为入参时可以使用@Param("keyName")来设置键,设置keyName后,list,array将会失效。 除了入参这种情况外,还有一种作为参数对象的某个字段的时候。
举个例子:如果User有属性List ids。入参是User对象,那么这个collection = "ids".如果User有属性Ids ids;其中Ids是个对象,Ids有个属性List id;
入参是User对象,那么collection = "ids.id"
select * from blog where 1=1 and (id=1 or id=2 or id=3)
我们现在传递一个万能的map,这map中可以存在一个集合!
-->
<select id="queryBlogForeach" parameterType="map" resultMap="BlogMap">
select * from blog
<where>
<foreach collection="ids" item="id" open="and (" close=")" separator="or">
id = #{id}
</foreach>
</where>
</select>
测试单元
/**
* @description: Foreach 的使用
* @author: zhengyuzhu
* @date: 2023/11/23 14:03
**/
@Test
public void testDemo5(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
ArrayList<Object> idList = new ArrayList<>();
idList.add(1);
idList.add(2);
idList.add(3);
HashMap<String, Object> blogMap = new HashMap<>();
blogMap.put("ids",idList);
List<Blog> blogList = blogMapper.queryBlogForeach(blogMap);//查询
for(Blog blog : blogList){
System.out.println(blog);
}
sqlSession.close();
/**
*
*
* 查询条件两个:输出如下:
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 360062456.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogForeach]-==> Preparing: select * from blog WHERE ( id = ? or id = ? or id = ? )
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogForeach]-==> Parameters: 1(Integer), 2(Integer), 3(Integer)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogForeach]-<== Total: 3
* Blog(id=1, title=如何学号java ?, author=小明, createTime=2023-11-23 00:00:00, views=30)
* Blog(id=2, title=张麻子学java, author=李老头, createTime=2023-11-22 00:00:00, views=560)
* Blog(id=3, title=张麻子学数据库, author=米老头, createTime=2023-11-22 00:00:00, views=760)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@15761df8]
*
*
*
**/
}
12.5 代码片段(复用)
有的时候,我们可以能会将一些功能的部分抽取出来,方便复用!
使用SQL标签抽取公共的部分
<sql id="if-title-author">
<if test="title != null">
title = #{title}
</if>
<if test="author != null">
and author = #{author}
</if>
</sql>
在需要使用的地方使用Include标签引用即可
这里有对结果集进行映射
<!--复用 SQL代码片段的方式-->
<select id="queryBlogIFThree" parameterType="map" resultMap="BlogMap">
select * from blog
<where>
<include refid="if-title-author"></include>
</where>
</select>
测试单元
/**
* @description: IF 的使用 复用代码片段
* @author: zhengyuzhu
* @date: 2023/11/23 14:33
**/
@Test
public void testDemo6(){
//第一步:获得SqlSession对象
SqlSession sqlSession = MybatisUtils.getSqlSession();
BlogMapper blogMapper = sqlSession.getMapper(BlogMapper.class);
HashMap<String, Object> blogMap = new HashMap<>();
blogMap.put("title","张麻子娶亲");
blogMap.put("author","张老头");
Blog blog = blogMapper.queryBlogIF(blogMap);//查询
System.out.println(blog);
sqlSession.close();
/**
*
*
* blogMap.put("title","张麻子娶亲");
* blogMap.put("author","张老头");
*
* 查询条件两个:输出如下:
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 846947180.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Preparing: select * from blog where 1=1 and title = ? and author = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Parameters: 张麻子娶亲(String), 张老头(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@327b636c]
*
*
* blogMap.put("title","张麻子娶亲");
* 查询条件一个输出如下
*
* [org.apache.ibatis.datasource.pooled.PooledDataSource]-Created connection 1172131546.
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Preparing: select * from blog where 1=1 and title = ?
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-==> Parameters: 张麻子娶亲(String)
* [com.zyz.mybatis.mapper.BlogMapper.queryBlogIF]-<== Total: 1
* Blog(id=1, title=张麻子娶亲, author=张老头, createTime=2023-11-23 00:00:00, views=30)
* [org.apache.ibatis.transaction.jdbc.JdbcTransaction]-Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@45dd4eda]
*
*
*
*
**/
}