![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MyBatis
WARGON
这个作者很懒,什么都没留下…
展开
-
mybatis入门
学习JDBC,是学习数据库连接的基础。在实际开发中,通常使用框架进行。mybatis就是支持定制化SQL、存储过程以及高级映射的优秀的持久层框架。以Idea为例,新建一个maven项目。首先,添加相关依赖:pom.xml。这里收藏一个网址:mvn依赖查询<?xml version="1.0" encoding="UTF-8"?><project xmlns="ht...原创 2018-07-25 16:59:54 · 178 阅读 · 0 评论 -
开发过程中使用MyBatis的大概思路:
1:设计好数据表。2:写Mybaits的配置文件3:编写与数据表对应的持久化类。4:编写mapper。如果采用XML的方式,需要为持久化类编写mapper配置文件。如果采用注解方式,为持久化类编写相应的Mapper类。5:写一个MyBatis的工具类,用来创建SqlSession6:最好创建service类,为每个持久化类进行操作的封装。7:然后就调用封装好的service...原创 2018-07-28 19:01:00 · 411 阅读 · 0 评论 -
MyBaTis报SSL错误Establishing SSL connection without server以及时区异常SQLxception: The server time zone value
1:web应用中连接mysql数据库时后台会出现这样的提示:Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must b...原创 2018-07-29 20:26:55 · 922 阅读 · 1 评论 -
spring-mabatis报错:Invalid bound statement (not found)
编写Dao接口的XML文件要求: mapper.xml的namespace要写所映射接口的全称类名。 mapper.xml中的每个statement的id要和接口方法的方法名相同 mapper.xml中定义的每个sql的parameterType要和接口方法的形参类型相同 mapper.xml中定义的每个sql的resultType要和接口方法的返回值的类型相同...原创 2018-08-02 12:45:31 · 757 阅读 · 1 评论 -
Spring声明式事务处理:基于tx命名空间
声明式事务处理,就是把事务处理工作从业务方法中抽取出来,然后进行横向的织入。依赖的jar包:spring*4+spring-jdbc+spring-aop+spring-tx+aspectJweaver。这里不是很确定,加上再说。配置文件:要有tx、aop约束。数据源到然要:<bean id="dataSource" class="org.springframework.j...原创 2018-08-03 13:56:40 · 1131 阅读 · 0 评论 -
Spring-Mybatis整合开发
1:导入依赖包:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation...原创 2018-08-03 15:26:05 · 167 阅读 · 0 评论 -
PageHelper的使用
没别的,直接整。什么Mybatis四大对象,不管了。引入Jar包:<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.0.0</ver...原创 2018-08-08 17:46:35 · 254 阅读 · 0 评论 -
Mybatis的Mapper文件sql语句中使用常量值或者枚举常量值
可以使用:枚举:'${@全路径名@枚举值.get属性()}',则会解析出枚举值的属性常量值,放入sql语句中。这里单引号''是因为${}占位符只是把值给填充进去,要表示字符串的话,加上单引号。常量:'${@全年路径名@常量值}',会解析出常量值,放入sql语句中。其实,方法、属性等也可以解析出来,就如同:类.静态属性、类.静态方法()。还有枚举转换器handler的处理方式,先不谈...原创 2018-08-19 18:15:32 · 3963 阅读 · 0 评论 -
mybatis异常:There is no getter for property named 'xxx in 'class java.lang.String'
在这种情况下:<select id="selectByTitle" parameterType="String" resultMap="ad"> select id,title,img_file_name,link,weight from ad <where> <if test="title!=null and title!=''"&原创 2018-08-17 10:03:40 · 1014 阅读 · 0 评论